Subject: Re: bug#32304: 27.0.50; tramp-tests issue with double slash

From: Michael Albinus <[email-masked]>
Date: Sun, 29 Jul 2018 18:27:40 +0200

Ken Brown <[email-masked]> writes:

Hi Ken,

> "//" has a special meaning at the beginning of a file name on Cygwin and
> MS-Windows; see the comment near the beginning of
> search_embedded_absfilename.  So I don't think there's a real bug here.
> Maybe the expected result of the test should simply be adjusted, as in
> the attached patch.  Someone who builds on MS-Windows would have to
> check this.

Thanks for the report. However, your patch seems just to hide the
problem in tramp-tests.el. Wouldn't it be better to fix this?

What about the appended patch?

> Ken

Best regards, Michael.

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index d56b09a604..1c1ed7a377 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3567,8 +3567,11 @@ tramp-handle-substitute-in-file-name
     ;; 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.
-      (let (process-environment)
+      ;; "//" has a special meaning at the beginning of a file name on
+      ;; Cygwin and MS-Windows.  And we do not want to replace
+      ;; environment variables, again.
+      (let ((system-type 'not-windows)
+            process-environment)
 	;; Ignore in LOCALNAME everything before "//" or "/~".
 	(when (stringp localname)
 	  (if (string-match "//\\(/\\|~\\)" localname)