GNU bug report logs - #76888
31.0.50; start-process: Spawning child process: Invalid argument

Previous Next

Package: emacs;

Reported by: Richard Copley <rcopley <at> gmail.com>

Date: Sun, 9 Mar 2025 12:39:01 UTC

Severity: normal

Found in version 31.0.50

Fixed in version 31.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Richard Copley <rcopley <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Michael Albinus <michael.albinus <at> gmx.de>, 76888 <at> debbugs.gnu.org
Subject: bug#76888: 31.0.50; start-process: Spawning child process: Invalid argument
Date: Mon, 24 Mar 2025 11:54:07 +0000
On Sun, 16 Mar 2025 at 10:24, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
> > From: Richard Copley <rcopley <at> gmail.com>
> > Date: Sun, 16 Mar 2025 09:39:32 +0000
> > Cc: michael.albinus <at> gmx.de, 76888 <at> debbugs.gnu.org
> >
> > On Sun, 16 Mar 2025 at 09:07, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > >
> > > > The first factor is that the value of shell-file-name sometimes gets
> > > > set buffer-locally in the "*Async Shell Command*" buffer. (This is
> > > > true for the Tramp code, when the buffer is reused. I don't know if it
> > > > is meaningful to ask whether it is true for the non-Tramp code.)
> > >
> > > If Tramp sets the buffer-local value in the "*Async Shell Command*"
> > > buffer, it should also set default-directory in that buffer.
> > >
> > > > The second factor is that 'async-shell-command' sometimes uses the
> > > > value of shell-file-name from the "*Async Shell Command*" buffer.
> > > > (This is true for the non-Tramp code. I don't know if it is true for
> > > > the Tramp code.)
> > >
> > > Please point out the code which uses the value of shell-file-name
> > > local to the "*Async Shell Command*" buffer.
> >
> > In 'shell-command' in "simple.el", 'start-process-shell-command'
> > is called after changing to the "*Async Shell Command*" buffer.
> >
> >         (let* ((buffer (get-buffer-create
> >                 (or output-buffer shell-command-buffer-name-async)))
> >                 [...])
> >           [...]
> >           (with-current-buffer buffer
> >         [...]
> >           (setq proc
> >             (start-process-shell-command "Shell" buffer command)))
> >
> > Then in the body of 'start-process-shell-command',
> >
> >   (start-process name buffer shell-file-name shell-command-switch command)
>
> That's a mistake: at least for local commands, the values of
> shell-file-name and shell-command-switch should come from the buffer
> that is current when the command is invoked.

It's easy to move the call to 'start-process-shell-command' outside
the 'with-current-buffer' form. I have patched my local emacs repo to
do that. It works just fine for me. Whether that is the right thing to
do I leave to your judgement. I refrain from attaching the patch since
I do not intend to complete a copyright assignment.




This bug report was last modified 55 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.