[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#13589: 24.2.92; wrongly escaped call-process arguments
From: |
Eli Zaretskii |
Subject: |
bug#13589: 24.2.92; wrongly escaped call-process arguments |
Date: |
Fri, 01 Feb 2013 12:12:57 +0200 |
> From: Shigeru Fukaya <shigeru.fukaya@gmail.com>
> Cc: 13589@debbugs.gnu.org
> Date: Fri, 01 Feb 2013 13:50:13 +0900
>
> Why I used CharNextExA is I can't find such functions for encoded
> strings in Emacs.
There aren't any, except when the strings are encoded in UTF-8.
> Possible alternative is to change the quoting
> process out of binary to elisp code. Or provide some hook for it?
We cannot move this to Lisp, I think, because C code calls
Fcall_process directly from C.
I think the right place for this processing is in Fcall_process,
around line 425 of callproc.c, where we encode the command-line
arguments and stuff them into new_argv[] array, to be passed to
child_setup. Each argument should be quoted _before_ it is encoded,
e.g., by running it through a w32-specific function. Since the Emacs
internal representation of characters is based on UTF-8, the problem
with backslashes incorrectly interpreted cannot happen if we do this
processing before encoding the result. We can then remove most of the
code in sys_spawnve that quotes special characters, except for quoting
argv[0] if it includes whitespace.
> And, anyway, could you please initialize 'escape_char'
Done in revision 111212 on the emacs-24 branch.
> so that we can safely set `w32-quote-process-args' to nil and do
> some quoting by ourselves (using advise or something).
Note that, even if w32-quote-process-args is nil, the current code in
sys_spawnve can still quote some parts of the command arguments, e.g.,
if an argument is empty. So initializing escape_char to zero is not
TRT, IMO; I initialized it to '\' instead.
Thanks.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#13589: 24.2.92; wrongly escaped call-process arguments,
Eli Zaretskii <=