[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111213: Make sure program names a
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r111213: Make sure program names are encoded before using them to invoke subprocesses. |
Date: |
Fri, 01 Feb 2013 12:15:36 +0200 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111213
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Fri 2013-02-01 12:15:36 +0200
message:
Make sure program names are encoded before using them to invoke subprocesses.
src/callproc.c (Fcall_process): Make sure program name in PATH and
new_argv[0] is encoded, if needed. Otherwise, un-encoded string
is passed to exec/spawnve, which fails unless the file-name
encoding is UTF-8.
modified:
src/ChangeLog
src/callproc.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-02-01 09:23:23 +0000
+++ b/src/ChangeLog 2013-02-01 10:15:36 +0000
@@ -1,5 +1,10 @@
2013-02-01 Eli Zaretskii <address@hidden>
+ * callproc.c (Fcall_process): Make sure program name in PATH and
+ new_argv[0] is encoded, if needed. Otherwise, un-encoded string
+ is passed to exec/spawnve, which fails unless the file-name
+ encoding is UTF-8.
+
* w32proc.c (sys_spawnve): Make sure escape_char is initialized,
even if w32-quote-process-args is nil.
=== modified file 'src/callproc.c'
--- a/src/callproc.c 2012-12-05 17:39:39 +0000
+++ b/src/callproc.c 2013-02-01 10:15:36 +0000
@@ -416,28 +416,34 @@
path = Fsubstring (path, make_number (2), Qnil);
new_argv = SAFE_ALLOCA ((nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv);
- if (nargs > 4)
- {
- ptrdiff_t i;
- struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-
- GCPRO5 (infile, buffer, current_dir, path, error_file);
- argument_coding.dst_multibyte = 0;
- for (i = 4; i < nargs; i++)
- {
- argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]);
- if (CODING_REQUIRE_ENCODING (&argument_coding))
- /* We must encode this argument. */
- args[i] = encode_coding_string (&argument_coding, args[i], 1);
- }
- UNGCPRO;
- for (i = 4; i < nargs; i++)
- new_argv[i - 3] = SDATA (args[i]);
- new_argv[i - 3] = 0;
- }
- else
- new_argv[1] = 0;
- new_argv[0] = SDATA (path);
+
+ {
+ struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
+
+ GCPRO5 (infile, buffer, current_dir, path, error_file);
+ if (nargs > 4)
+ {
+ ptrdiff_t i;
+
+ argument_coding.dst_multibyte = 0;
+ for (i = 4; i < nargs; i++)
+ {
+ argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]);
+ if (CODING_REQUIRE_ENCODING (&argument_coding))
+ /* We must encode this argument. */
+ args[i] = encode_coding_string (&argument_coding, args[i], 1);
+ }
+ for (i = 4; i < nargs; i++)
+ new_argv[i - 3] = SDATA (args[i]);
+ new_argv[i - 3] = 0;
+ }
+ else
+ new_argv[1] = 0;
+ if (STRING_MULTIBYTE (path))
+ path = ENCODE_FILE (path);
+ new_argv[0] = SDATA (path);
+ UNGCPRO;
+ }
#ifdef MSDOS /* MW, July 1993 */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r111213: Make sure program names are encoded before using them to invoke subprocesses.,
Eli Zaretskii <=