aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2020-11-21 16:00:17 +0100
committerMichael Albinus2020-11-21 16:00:17 +0100
commit3ceee398192e312faa3ea073365c49bcce9ef61b (patch)
tree6ba0512b4f0c92a9bcc4bd24814907cf7808037b
parenta824888188f3046dca1c059ea6fc60fd822c2868 (diff)
downloademacs-3ceee398192e312faa3ea073365c49bcce9ef61b.tar.gz
emacs-3ceee398192e312faa3ea073365c49bcce9ef61b.zip
Fix Bug#44481
* lisp/net/tramp.el (tramp-system-name): New defconst. (tramp-default-host, tramp-restricted-shell-hosts-alist) (tramp-local-host-regexp): * lisp/net/tramp-sh.el (tramp-maybe-open-connection): Use it. (Bug#44481)
-rw-r--r--lisp/net/tramp-sh.el2
-rw-r--r--lisp/net/tramp.el14
2 files changed, 11 insertions, 5 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 4dca040aebb..a70d3aaf846 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -5022,7 +5022,7 @@ connection if a previous connection has died for some reason."
5022 (setenv "PS1" tramp-initial-end-of-output) 5022 (setenv "PS1" tramp-initial-end-of-output)
5023 (unless (stringp tramp-encoding-shell) 5023 (unless (stringp tramp-encoding-shell)
5024 (tramp-error vec 'file-error "`tramp-encoding-shell' not set")) 5024 (tramp-error vec 'file-error "`tramp-encoding-shell' not set"))
5025 (let* ((current-host (system-name)) 5025 (let* ((current-host tramp-system-name)
5026 (target-alist (tramp-compute-multi-hops vec)) 5026 (target-alist (tramp-compute-multi-hops vec))
5027 ;; We will apply `tramp-ssh-controlmaster-options' 5027 ;; We will apply `tramp-ssh-controlmaster-options'
5028 ;; only for the first hop. 5028 ;; only for the first hop.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 08bc0ffdd7d..5a08fa89339 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -173,6 +173,12 @@ See the variable `tramp-encoding-shell' for more information."
173 :version "24.1" 173 :version "24.1"
174 :type '(choice (const nil) string)) 174 :type '(choice (const nil) string))
175 175
176;; Since Emacs 26.1, `system-name' can return `nil' at build time if
177;; Emacs is compiled with "--no-build-details". We do expect it to be
178;; a string. (Bug#44481)
179(defconst tramp-system-name (or (system-name) "")
180 "The system name Tramp is running locally.")
181
176(defvar tramp-methods nil 182(defvar tramp-methods nil
177 "Alist of methods for remote files. 183 "Alist of methods for remote files.
178This is a list of entries of the form (NAME PARAM1 PARAM2 ...). 184This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
@@ -410,7 +416,7 @@ empty string for the method name."
410 (choice :tag " Host regexp" regexp sexp) 416 (choice :tag " Host regexp" regexp sexp)
411 (choice :tag " User name" string (const nil))))) 417 (choice :tag " User name" string (const nil)))))
412 418
413(defcustom tramp-default-host (system-name) 419(defcustom tramp-default-host tramp-system-name
414 "Default host to use for transferring files. 420 "Default host to use for transferring files.
415Useful for su and sudo methods mostly." 421Useful for su and sudo methods mostly."
416 :type 'string) 422 :type 'string)
@@ -465,8 +471,8 @@ interpreted as a regular expression which always matches."
465(defcustom tramp-restricted-shell-hosts-alist 471(defcustom tramp-restricted-shell-hosts-alist
466 (when (memq system-type '(windows-nt)) 472 (when (memq system-type '(windows-nt))
467 (list (format "\\`\\(%s\\|%s\\)\\'" 473 (list (format "\\`\\(%s\\|%s\\)\\'"
468 (regexp-quote (downcase (system-name))) 474 (regexp-quote (downcase tramp-system-name))
469 (regexp-quote (upcase (system-name)))))) 475 (regexp-quote (upcase tramp-system-name)))))
470 "List of hosts, which run a restricted shell. 476 "List of hosts, which run a restricted shell.
471This is a list of regular expressions, which denote hosts running 477This is a list of regular expressions, which denote hosts running
472a restricted shell like \"rbash\". Those hosts can be used as 478a restricted shell like \"rbash\". Those hosts can be used as
@@ -479,7 +485,7 @@ host runs a restricted shell, it shall be added to this list, too."
479 (concat 485 (concat
480 "\\`" 486 "\\`"
481 (regexp-opt 487 (regexp-opt
482 (list "localhost" "localhost6" (system-name) "127.0.0.1" "::1") t) 488 (list "localhost" "localhost6" tramp-system-name "127.0.0.1" "::1") t)
483 "\\'") 489 "\\'")
484 "Host names which are regarded as local host. 490 "Host names which are regarded as local host.
485If the local host runs a chrooted environment, set this to nil." 491If the local host runs a chrooted environment, set this to nil."