emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116230: Fix bug #16558 with w32-shell-execute on re


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r116230: Fix bug #16558 with w32-shell-execute on remote file names.
Date: Sat, 01 Feb 2014 09:23:51 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116230
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16558
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2014-02-01 11:22:51 +0200
message:
  Fix bug #16558 with w32-shell-execute on remote file names.
  
   src/w32fns.c (Fw32_shell_execute): Don't call file-exists-p for
   DOCUMENT that is a "remote" file name, i.e. a file-handler exists
   for it.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/w32fns.c                   w32fns.c-20091113204419-o5vbwnq5f7feedwu-945
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-01-31 02:43:03 +0000
+++ b/src/ChangeLog     2014-02-01 09:22:51 +0000
@@ -1,3 +1,9 @@
+2014-02-01  Eli Zaretskii  <address@hidden>
+
+       * w32fns.c (Fw32_shell_execute): Don't call file-exists-p for
+       DOCUMENT that is a "remote" file name, i.e. a file-handler exists
+       for it.  (Bug#16558)
+
 2014-01-30  Andreas Schwab  <address@hidden>
 
        * process.c (create_process): Reset SIGPROF handler in the child.

=== modified file 'src/w32fns.c'
--- a/src/w32fns.c      2014-01-29 10:29:14 +0000
+++ b/src/w32fns.c      2014-02-01 09:22:51 +0000
@@ -6892,7 +6892,8 @@
 #ifndef CYGWIN
   int use_unicode = w32_unicode_filenames;
   char *doc_a = NULL, *params_a = NULL, *ops_a = NULL;
-  Lisp_Object absdoc;
+  Lisp_Object absdoc, handler;
+  struct gcpro gcpro1;
 #endif
 
   CHECK_STRING (document);
@@ -6927,10 +6928,24 @@
      does not have to be a file, it can be a URL, for example.  So we
      make it absolute only if it is an existing file; if it is a file
      that does not exist, tough.  */
+  GCPRO1 (absdoc);
   absdoc = Fexpand_file_name (document, Qnil);
-  if (!NILP (Ffile_exists_p (absdoc)))
-    document = absdoc;
-  document = ENCODE_FILE (document);
+  /* Don't call file handlers for file-exists-p, since they might
+     attempt to access the file, which could fail or produce undesired
+     consequences, see bug#16558 for an example.  */
+  handler = Ffind_file_name_handler (absdoc, Qfile_exists_p);
+  if (NILP (handler))
+    {
+      Lisp_Object absdoc_encoded = ENCODE_FILE (absdoc);
+
+      if (faccessat (AT_FDCWD, SSDATA (absdoc_encoded), F_OK, AT_EACCESS) == 0)
+       document = absdoc_encoded;
+      else
+       document = ENCODE_FILE (document);
+    }
+  else
+    document = ENCODE_FILE (document);
+  UNGCPRO;
   if (use_unicode)
     {
       wchar_t document_w[MAX_PATH], current_dir_w[MAX_PATH];


reply via email to

[Prev in Thread] Current Thread [Next in Thread]