Subject: Re: bug#38079: On Windows tramp hangs after server-start is called

From: Michael Albinus <[email-masked]>
Date: Thu, 07 Nov 2019 16:23:16 +0100

Wanrong Lin <[email-masked]> writes:

Hi,

> Yes that can be another way to fix. The downside is we don't know this
> system-name upper/lower case change will cause any surprises somewhere
> else. But I don't understand the underlying difficulty to ensure
> system-name never changes. Thanks for fixing it either way.

Does the appended patch fix the problem for you?

> Warren

Best regards, Michael.

diff --git a/lisp/tramp.el b/lisp/tramp.el
index b1ad1922..7b929255 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -457,15 +457,20 @@ interpreted as a regular expression which always matches."
   :version "24.3"
   :type 'boolean)

+;; For some obscure technical reasons, `system-name' on w32 returns
+;; either lower case or upper case letters.  See
+;; <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38079#20>.
 (defcustom tramp-restricted-shell-hosts-alist
   (when (memq system-type '(windows-nt))
-    (list (concat "\\`" (regexp-quote (system-name)) "\\'")))
+    (list (format "\\`\\(%s\\|%s\\)\\'"
+		  (regexp-quote (downcase (system-name)))
+		  (regexp-quote (upcase (system-name))))))
   "List of hosts, which run a restricted shell.
 This is a list of regular expressions, which denote hosts running
 a registered shell like \"rbash\".  Those hosts can be used as
 proxies only, see `tramp-default-proxies-alist'.  If the local
 host runs a registered shell, it shall be added to this list, too."
-  :version "24.3"
+  :version "27.1"
   :type '(repeat (regexp :tag "Host regexp")))

 (defcustom tramp-local-host-regexp