emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 4e464fa: Handle chrooted environments in Tramp


From: Michael Albinus
Subject: [Emacs-diffs] master 4e464fa: Handle chrooted environments in Tramp
Date: Thu, 19 Apr 2018 05:04:47 -0400 (EDT)

branch: master
commit 4e464fa98ae677451b4e4b722b0cf545a97ebbba
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Handle chrooted environments in Tramp
    
    * doc/misc/tramp.texi (Frequently Asked Questions): New item, chrooted
    environments.
    
    * lisp/net/tramp.el (tramp-local-host-regexp): Make it a defcustom.
    Allow nil.
    (tramp-local-host-p):
    * lisp/net/tramp-sh.el (tramp-compute-multi-hops): Handle this.
---
 doc/misc/tramp.texi  | 11 +++++++++++
 lisp/net/tramp-sh.el |  2 +-
 lisp/net/tramp.el    | 15 +++++++++++----
 3 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index f0ea073..7ae7150 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -3294,6 +3294,7 @@ Keep the file @option{tramp-persistency-file-name}, which 
is where
 @value{tramp} caches remote information about hosts and files.  Caching
 is enabled by default.  Don't disable it.
 
address@hidden remote-file-name-inhibit-cache
 Set @code{remote-file-name-inhibit-cache} to @code{nil} if remote
 files are not independently updated outside @value{tramp}'s control.
 That cache cleanup will be necessary if the remote directories or
@@ -3428,6 +3429,16 @@ first saving to a temporary file.
 
 
 @item
address@hidden fails in a chrooted environment
+
address@hidden tramp-local-host-regexp
+When connecting to a local host, @value{tramp} uses some internal
+optimizations.  They fail, when there is a chrooted environment.  In
+order to disable those optimizations, set user option
address@hidden to @code{nil}.
+
+
address@hidden
 @value{tramp} does not recognize if a @command{ssh} session hangs
 
 @command{ssh} sessions on the local host hang when the network is
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 3ba3d95..2fb5566 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4634,7 +4634,7 @@ Goes through the list `tramp-inline-compress-commands'."
     ;; host name in their command template.  In this case, the remote
     ;; file name must use either a local host name (first hop), or a
     ;; host name matching the previous hop.
-    (let ((previous-host tramp-local-host-regexp))
+    (let ((previous-host (or tramp-local-host-regexp "")))
       (setq choices target-alist)
       (while (setq item (pop choices))
        (let ((host (tramp-file-name-host item)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 52ff021..5c785b1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -428,13 +428,19 @@ host runs a registered shell, it shall be added to this 
list, too."
   :require 'tramp)
 
 ;;;###tramp-autoload
-(defconst tramp-local-host-regexp
+(defcustom tramp-local-host-regexp
   (concat
    "\\`"
    (regexp-opt
     (list "localhost" "localhost6" (system-name) "127.0.0.1" "::1") t)
    "\\'")
-  "Host names which are regarded as local host.")
+  "Host names which are regarded as local host.
+If the local host runs a chrooted environment, set this to nil."
+  :version "27.1"
+  :group 'tramp
+  :type '(choice (const :tag "Chrooted environment" nil)
+                (regexp :tag "Host regexp"))
+  :require 'tramp)
 
 (defvar tramp-completion-function-alist nil
   "Alist of methods for remote files.
@@ -4239,11 +4245,12 @@ be granted."
 
 ;;;###tramp-autoload
 (defun tramp-local-host-p (vec)
-  "Return t if this points to the local host, nil otherwise."
+  "Return t if this points to the local host, nil otherwise.
+This handles also chrooted environments, which are not regarded as local."
   (let ((host (tramp-file-name-host vec))
        (port (tramp-file-name-port vec)))
     (and
-     (stringp host)
+     (stringp tramp-local-host-regexp) (stringp host)
      (string-match tramp-local-host-regexp host)
      ;; A port is an indication for an ssh tunnel or alike.
      (null port)



reply via email to

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