]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Bug#32304
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 31 Jul 2018 04:50:30 +0000 (06:50 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 31 Jul 2018 04:50:30 +0000 (06:50 +0200)
* lisp/net/tramp.el (tramp-handle-substitute-in-file-name):
Handle special cas on Cygwin and MS-Windows.  (Bug#32304)

lisp/net/tramp.el

index d56b09a604d0643cd5a263f8e212846a8991df86..1af2defd58697030378602b7e3aa2a04ec4410b2 100644 (file)
@@ -3567,16 +3567,20 @@ support symbolic links."
     ;; First, we must replace environment variables.
     (setq filename (tramp-replace-environment-variables filename))
     (with-parsed-tramp-file-name filename nil
-      ;; We do not want to replace environment variables, again.
+      ;; We do not want to replace environment variables, again.  "//"
+      ;; has a special meaning at the beginning of a file name on
+      ;; Cygwin and MS-Windows, we must remove it.
       (let (process-environment)
        ;; Ignore in LOCALNAME everything before "//" or "/~".
        (when (stringp localname)
          (if (string-match "//\\(/\\|~\\)" localname)
-             (setq filename (substitute-in-file-name localname))
+             (setq filename
+                    (replace-regexp-in-string
+                     "\\`/+" "/" (substitute-in-file-name localname)))
            (setq filename
                  (concat (file-remote-p filename)
-                         (tramp-run-real-handler
-                          'substitute-in-file-name (list localname)))))))
+                         (replace-regexp-in-string
+                           "\\`/+" "/" (substitute-in-file-name localname)))))))
       ;; "/m:h:~" does not work for completion.  We use "/m:h:~/".
       (if (and (stringp localname) (string-equal "~" localname))
          (concat filename "/")