From: Eli Zaretskii <eliz@gnu.org>
To: Shigeru Fukaya <shigeru.fukaya@gmail.com>
Cc: 13589@debbugs.gnu.org
Subject: bug#13589: 24.2.92; wrongly escaped call-process arguments
Date: Fri, 01 Feb 2013 12:12:57 +0200 [thread overview]
Message-ID: <837gmscpg6.fsf@gnu.org> (raw)
In-Reply-To: <B3CE00379EFEA7shigeru.fukaya@gmail.com>
> 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 parent reply other threads:[~2013-02-01 10:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-30 16:36 bug#13589: 24.2.92; wrongly escaped call-process arguments Shigeru Fukaya
2013-01-30 17:55 ` Eli Zaretskii
2013-02-01 4:50 ` Shigeru Fukaya
2013-02-01 10:12 ` Eli Zaretskii [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=837gmscpg6.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=13589@debbugs.gnu.org \
--cc=shigeru.fukaya@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.