diff options
| author | Michael Albinus | 2018-04-19 11:04:01 +0200 |
|---|---|---|
| committer | Michael Albinus | 2018-04-19 11:04:01 +0200 |
| commit | 4e464fa98ae677451b4e4b722b0cf545a97ebbba (patch) | |
| tree | e694e794300787c87224eb761e833e15f2572713 | |
| parent | 0ac64af1d4a9ff8af0f6418b81fc7ea6eed465db (diff) | |
| download | emacs-4e464fa98ae677451b4e4b722b0cf545a97ebbba.tar.gz emacs-4e464fa98ae677451b4e4b722b0cf545a97ebbba.zip | |
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.
| -rw-r--r-- | doc/misc/tramp.texi | 11 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 2 | ||||
| -rw-r--r-- | 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 f0ea073ed09..7ae7150930a 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 | |||
| 3294 | @value{tramp} caches remote information about hosts and files. Caching | 3294 | @value{tramp} caches remote information about hosts and files. Caching |
| 3295 | is enabled by default. Don't disable it. | 3295 | is enabled by default. Don't disable it. |
| 3296 | 3296 | ||
| 3297 | @vindex remote-file-name-inhibit-cache | ||
| 3297 | Set @code{remote-file-name-inhibit-cache} to @code{nil} if remote | 3298 | Set @code{remote-file-name-inhibit-cache} to @code{nil} if remote |
| 3298 | files are not independently updated outside @value{tramp}'s control. | 3299 | files are not independently updated outside @value{tramp}'s control. |
| 3299 | That cache cleanup will be necessary if the remote directories or | 3300 | That cache cleanup will be necessary if the remote directories or |
| @@ -3428,6 +3429,16 @@ first saving to a temporary file. | |||
| 3428 | 3429 | ||
| 3429 | 3430 | ||
| 3430 | @item | 3431 | @item |
| 3432 | @value{tramp} fails in a chrooted environment | ||
| 3433 | |||
| 3434 | @vindex tramp-local-host-regexp | ||
| 3435 | When connecting to a local host, @value{tramp} uses some internal | ||
| 3436 | optimizations. They fail, when there is a chrooted environment. In | ||
| 3437 | order to disable those optimizations, set user option | ||
| 3438 | @option{tramp-local-host-regexp} to @code{nil}. | ||
| 3439 | |||
| 3440 | |||
| 3441 | @item | ||
| 3431 | @value{tramp} does not recognize if a @command{ssh} session hangs | 3442 | @value{tramp} does not recognize if a @command{ssh} session hangs |
| 3432 | 3443 | ||
| 3433 | @command{ssh} sessions on the local host hang when the network is | 3444 | @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 3ba3d956efc..2fb5566a3bf 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'." | |||
| 4634 | ;; host name in their command template. In this case, the remote | 4634 | ;; host name in their command template. In this case, the remote |
| 4635 | ;; file name must use either a local host name (first hop), or a | 4635 | ;; file name must use either a local host name (first hop), or a |
| 4636 | ;; host name matching the previous hop. | 4636 | ;; host name matching the previous hop. |
| 4637 | (let ((previous-host tramp-local-host-regexp)) | 4637 | (let ((previous-host (or tramp-local-host-regexp ""))) |
| 4638 | (setq choices target-alist) | 4638 | (setq choices target-alist) |
| 4639 | (while (setq item (pop choices)) | 4639 | (while (setq item (pop choices)) |
| 4640 | (let ((host (tramp-file-name-host item))) | 4640 | (let ((host (tramp-file-name-host item))) |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 52ff021c500..5c785b16d89 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." | |||
| 428 | :require 'tramp) | 428 | :require 'tramp) |
| 429 | 429 | ||
| 430 | ;;;###tramp-autoload | 430 | ;;;###tramp-autoload |
| 431 | (defconst tramp-local-host-regexp | 431 | (defcustom tramp-local-host-regexp |
| 432 | (concat | 432 | (concat |
| 433 | "\\`" | 433 | "\\`" |
| 434 | (regexp-opt | 434 | (regexp-opt |
| 435 | (list "localhost" "localhost6" (system-name) "127.0.0.1" "::1") t) | 435 | (list "localhost" "localhost6" (system-name) "127.0.0.1" "::1") t) |
| 436 | "\\'") | 436 | "\\'") |
| 437 | "Host names which are regarded as local host.") | 437 | "Host names which are regarded as local host. |
| 438 | If the local host runs a chrooted environment, set this to nil." | ||
| 439 | :version "27.1" | ||
| 440 | :group 'tramp | ||
| 441 | :type '(choice (const :tag "Chrooted environment" nil) | ||
| 442 | (regexp :tag "Host regexp")) | ||
| 443 | :require 'tramp) | ||
| 438 | 444 | ||
| 439 | (defvar tramp-completion-function-alist nil | 445 | (defvar tramp-completion-function-alist nil |
| 440 | "Alist of methods for remote files. | 446 | "Alist of methods for remote files. |
| @@ -4239,11 +4245,12 @@ be granted." | |||
| 4239 | 4245 | ||
| 4240 | ;;;###tramp-autoload | 4246 | ;;;###tramp-autoload |
| 4241 | (defun tramp-local-host-p (vec) | 4247 | (defun tramp-local-host-p (vec) |
| 4242 | "Return t if this points to the local host, nil otherwise." | 4248 | "Return t if this points to the local host, nil otherwise. |
| 4249 | This handles also chrooted environments, which are not regarded as local." | ||
| 4243 | (let ((host (tramp-file-name-host vec)) | 4250 | (let ((host (tramp-file-name-host vec)) |
| 4244 | (port (tramp-file-name-port vec))) | 4251 | (port (tramp-file-name-port vec))) |
| 4245 | (and | 4252 | (and |
| 4246 | (stringp host) | 4253 | (stringp tramp-local-host-regexp) (stringp host) |
| 4247 | (string-match tramp-local-host-regexp host) | 4254 | (string-match tramp-local-host-regexp host) |
| 4248 | ;; A port is an indication for an ssh tunnel or alike. | 4255 | ;; A port is an indication for an ssh tunnel or alike. |
| 4249 | (null port) | 4256 | (null port) |