]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bug #13661 with w32-downcase-file-names and shell-command.
authorEli Zaretskii <eliz@gnu.org>
Sat, 9 Feb 2013 16:36:53 +0000 (18:36 +0200)
committerEli Zaretskii <eliz@gnu.org>
Sat, 9 Feb 2013 16:36:53 +0000 (18:36 +0200)
 src/callproc.c (Fcall_process_region): Make sure the XXXXXX part of
 the temporary file pattern is not downcased even when
 w32-downcase-file-names is non-nil.

src/ChangeLog
src/callproc.c

index 599c515e858567a788d003e1eccbe1c8cb1b7dab..35e313c1afb255926c9d4228b8ed7eee521fc686 100644 (file)
@@ -1,5 +1,9 @@
 2013-02-09  Eli Zaretskii  <eliz@gnu.org>
 
+       * callproc.c (Fcall_process_region): Make sure the XXXXXX part of
+       the temporary file pattern is not downcased even when
+       w32-downcase-file-names is non-nil.  (Bug#13661)
+
        * xdisp.c (decode_mode_spec): Remove handling of %t.
 
        * msdos.c (careadlinkatcwd): Remove.
index ea79da7ff5a2e95cd38d1d355aec88c00860ad4b..cb11ee0cc53a9520da90b794ee0d8ea4b5b026fc 100644 (file)
@@ -1016,8 +1016,26 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
   {
     USE_SAFE_ALLOCA;
     Lisp_Object pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir);
-    Lisp_Object encoded_tem = ENCODE_FILE (pattern);
-    char *tempfile = SAFE_ALLOCA (SBYTES (encoded_tem) + 1);
+    Lisp_Object encoded_tem;
+    char *tempfile;
+
+#ifdef WINDOWSNT
+    /* Cannot use the result of Fexpand_file_name, because it
+       downcases the XXXXXX part of the pattern, and mktemp then
+       doesn't recognize it.  */
+    if (!NILP (Vw32_downcase_file_names))
+      {
+       Lisp_Object dirname = Ffile_name_directory (pattern);
+
+       if (NILP (dirname))
+         pattern = Vtemp_file_name_pattern;
+       else
+         pattern = concat2 (dirname, Vtemp_file_name_pattern);
+      }
+#endif
+
+    encoded_tem = ENCODE_FILE (pattern);
+    tempfile = SAFE_ALLOCA (SBYTES (encoded_tem) + 1);
     memcpy (tempfile, SDATA (encoded_tem), SBYTES (encoded_tem) + 1);
     coding_systems = Qt;