Subject: 31.0.50; start-process: Spawning child process: Invalid argument
From: Richard Copley <[email-masked]>
To: [email-masked]
Date: Sun, 9 Mar 2025 12:37:56 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

When the "*Async Shell Command*" buffer is re-used, its
connection-local variable 'shell-file-name' is set permanently instead
of temporarily, and if the value is inappropriate, an error ensues.

Recipe from 'emacs -Q', on Windows:

Visit a remote file on a Linux system using tramp. (You will need to
substitute an appropriate remote file name here.)

[C-x C-f] /plink:xxx:/ [RET]

Execute an asynchronous shell command.

[M-&] echo [RET]

NOTE: (with-current-buffer "*Async Shell Command*" shell-file-name)
returns the path to "cmdproxy.exe" as expected.

Execute an asynchronous shell command again.

[M-&] echo [RET]

NOTE: (with-current-buffer "*Async Shell Command*" shell-file-name)
now returns "/bin/sh".

Visit a local file.

[C-x C-f C-a C-k] C:/ [RET]

Execute an async shell command.

[M-&] echo [RET]

An error is signalled, with the message "start-process: Spawning child
process: Invalid argument". (Note, the invalid argument is the
executable name, "/bin/sh").

In GNU Emacs 31.0.50 (build 1, x86_64-w64-mingw32) of 2025-03-01 built
 on MACHINE
Repository revision: 2095d0fcc686107c2ee25f75983710ca5f4abacf
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19045
System Description: Microsoft Windows 10 Pro (v10.0.2009.19045.5555)

Configured using:
 'configure --config-cache --with-modules --without-pop
 --without-compress-install --with-tree-sitter=ifavailable
 --without-libsystemd --without-dbus --without-gconf --without-gsettings
 --without-mailutils --with-small-ja-dic --with-native-compilation=aot
 --prefix=/mingw64 --build=x86_64-w64-mingw32 'CFLAGS=-O2'

Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Important settings:
  value of $LANG: ENG
  locale-coding-system: cp1252

Major mode: Messages

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug lisp-mnt message mailcap yank-media puny
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util
text-property-search mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils dired-aux dired dired-loaddefs tramp-cmds
tramp-cache time-stamp tramp-sh comp-run comp-common tramp rx trampver
tramp-integration files-x tramp-message help-mode tramp-compat xdg shell
pcomplete comint ansi-osc ring parse-time iso8601 time-date format-spec
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile ansi-color tramp-loaddefs
cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
touch-screen dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars
term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads w32notify w32 lcms2 multi-tty move-toolbar make-network-process
tty-child-frames native-compile emacs)

Memory information:
((conses 16 108744 17611) (symbols 48 9243 0) (strings 32 30108 2194)
 (string-bytes 1 1031459) (vectors 16 16442)
 (vector-slots 8 220843 10978) (floats 8 36 12) (intervals 56 782 25)
 (buffers 992 15))