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: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
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: Wed, 22 Oct 2014 20:12:18 +0300
> Date: Tue, 21 Oct 2014 21:12:27 -0400
> From: Noam Postavsky <npostavs <at> users.sourceforge.net>
> Cc: 18745 <at> debbugs.gnu.org
> 
> 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.

Thanks, the changes look reasonable.  If you didn't already, please
run the test suite and make sure there are no regressions due to these
changes.  Bonus points for adding specialized tests to test this
specific issue.

> 	* nt/cmdproxy.c (batch_file_p): new function.
> 	(spawn): if calling a quoted batch file pass NULL for progname.
> 	* src/w32proc.c (create_child): if calling a quoted batch file
> 	pass NULL for exe.

In the future, please begin each ChangeLog entry with a capital
letter.

> +  /* CreateProcess handles batch files as progname specially. This
> +     special handling fails when both the batch file and arguments are
> +     quoted. We pass NULL as progname to avoid the special
> +     handling. */

Please in the future leave 2 spaces between sentences, per the US
English convention we use in Emacs.

> +  if (progname != NULL && cmdline[0] == '"' && batch_file_p(progname))
> +      progname = NULL;

Our coding style is to leave one space between the function name and
the opening parenthesis that follows it.

If there are no more comments or objections, I will commit in a few
days.

Thanks again for working on this.




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.