GNU bug report logs - #18745
24.3; MS Windows, `call-process-shell-command' fails on `shell-quote-argument'ed bat file with quoted args

Previous Next

Package: emacs;

Reported by: Noam Postavsky <npostavs <at> users.sourceforge.net>

Date: Thu, 16 Oct 2014 04:35:01 UTC

Severity: minor

Found in versions 25.0.50, 24.3

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18745 <at> debbugs.gnu.org
Subject: bug#18745: 24.3; MS Windows, `call-process-shell-command' fails on `shell-quote-argument'ed bat file with quoted args
Date: Tue, 21 Oct 2014 21:12:27 -0400
[Message part 1 (text/plain, inline)]
On Thu, Oct 16, 2014 at 5:30 PM, Noam Postavsky
<npostavs <at> users.sourceforge.net> wrote:
> On Thu, Oct 16, 2014 at 1:06 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> GNU Make overcomes this by detecting these cases, and invoking
>> CreateProcess in a special way (NULL as the first argument), see the
>> function process_begin there, around line 710 of sub_proc.c in the GNU
>> Make sources.  If you can come up with a way to do the same in Emacs,
>> by some suitable patch to cmdproxy.c, such a patch will be welcome
>> (assuming either the patch is small, or you will agree to sign legal
>> papers necessary for submitting substantial patches to FSF projects).
>
> I'll take a look (btw I have already signed for Emacs).

Patching cmdproxy.c fixes the call-process-shell-command case:

  (call-process-shell-command
   "\"c:/path with space/foo-bar.bat\" \"x &y\"" nil '(t t) t)

To fix the call-process case:

  (call-process
   "c:/path with space/foo-bar.bat" nil '(t t) t "x &y")

required a patch to w32proc.c. This is my first patch to Emacs proper;
hopefully I got everything in the right format.
[bat-quote.ChangeLog (application/octet-stream, attachment)]
[bat-quote.patch (application/octet-stream, attachment)]

This bug report was last modified 9 years and 208 days ago.

Previous Next


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