diff options
| author | Michael Albinus | 2017-05-23 09:25:03 +0200 |
|---|---|---|
| committer | Michael Albinus | 2017-05-23 09:25:03 +0200 |
| commit | 107e60f49db71f1869848f0f0ce5ea7dd057366c (patch) | |
| tree | 80cd579d35f0d79d3ab00c0324415c731ba4778c | |
| parent | ad2f52a14312b1b33f235103189b033b7ed87ddd (diff) | |
| download | emacs-107e60f49db71f1869848f0f0ce5ea7dd057366c.tar.gz emacs-107e60f49db71f1869848f0f0ce5ea7dd057366c.zip | |
Add test for Bug#27009 in tramp-tests.el
* lisp/net/tramp-sh.el (tramp-compute-multi-hops):
Check `tramp-file-name-real-host' for being a local host.
* lisp/net/tramp.el (tramp-postfix-host-regexp): Fix docstring.
* test/lisp/net/tramp-tests.el (tramp-test-temporary-file-directory):
Declare default host for mock method.
(tramp-test29-environment-variables-and-port-numbers): New test.
| -rw-r--r-- | lisp/net/tramp-sh.el | 2 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 4 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 41 |
3 files changed, 45 insertions, 2 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 9b001a90e78..999de8e8504 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -4546,7 +4546,7 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4546 | ;; host name. | 4546 | ;; host name. |
| 4547 | (let* ((v (car target-alist)) | 4547 | (let* ((v (car target-alist)) |
| 4548 | (method (tramp-file-name-method v)) | 4548 | (method (tramp-file-name-method v)) |
| 4549 | (host (tramp-file-name-host v))) | 4549 | (host (tramp-file-name-real-host v))) |
| 4550 | (unless | 4550 | (unless |
| 4551 | (or | 4551 | (or |
| 4552 | ;; There are multi-hops. | 4552 | ;; There are multi-hops. |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 5b1e478db04..70abb89194d 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -837,7 +837,7 @@ Used in `tramp-make-tramp-file-name'." | |||
| 837 | 837 | ||
| 838 | (defun tramp-postfix-host-regexp () | 838 | (defun tramp-postfix-host-regexp () |
| 839 | "Regexp matching delimiter between host names and localnames. | 839 | "Regexp matching delimiter between host names and localnames. |
| 840 | nDerived from `tramp-postfix-host-format'." | 840 | Derived from `tramp-postfix-host-format'." |
| 841 | (regexp-quote (tramp-postfix-host-format))) | 841 | (regexp-quote (tramp-postfix-host-format))) |
| 842 | 842 | ||
| 843 | (defconst tramp-localname-regexp ".*$" | 843 | (defconst tramp-localname-regexp ".*$" |
| @@ -4396,6 +4396,8 @@ Only works for Bourne-like shells." | |||
| 4396 | ;; * Use also port to distinguish connections. This is needed for | 4396 | ;; * Use also port to distinguish connections. This is needed for |
| 4397 | ;; different hosts sitting behind a single router (distinguished by | 4397 | ;; different hosts sitting behind a single router (distinguished by |
| 4398 | ;; different port numbers). (Tzvi Edelman) | 4398 | ;; different port numbers). (Tzvi Edelman) |
| 4399 | ;; Also needed for different systems serve SSH on different ports of | ||
| 4400 | ;; the same IP address. (Bug#27009) | ||
| 4399 | ;; | 4401 | ;; |
| 4400 | ;; * Refactor code from different handlers. Start with | 4402 | ;; * Refactor code from different handlers. Start with |
| 4401 | ;; *-process-file. One idea is to generalize `tramp-send-command' | 4403 | ;; *-process-file. One idea is to generalize `tramp-send-command' |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 49c32dbaaf2..0106807a9ac 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -67,6 +67,9 @@ | |||
| 67 | (tramp-remote-shell "/bin/sh") | 67 | (tramp-remote-shell "/bin/sh") |
| 68 | (tramp-remote-shell-args ("-c")) | 68 | (tramp-remote-shell-args ("-c")) |
| 69 | (tramp-connection-timeout 10))) | 69 | (tramp-connection-timeout 10))) |
| 70 | (add-to-list | ||
| 71 | 'tramp-default-host-alist | ||
| 72 | `("\\`mock\\'" nil ,(system-name))) | ||
| 70 | (format "/mock::%s" temporary-file-directory))) | 73 | (format "/mock::%s" temporary-file-directory))) |
| 71 | "Temporary directory for Tramp tests.") | 74 | "Temporary directory for Tramp tests.") |
| 72 | 75 | ||
| @@ -2920,6 +2923,42 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2920 | (regexp-quote envvar) | 2923 | (regexp-quote envvar) |
| 2921 | (funcall this-shell-command-to-string "set"))))))))) | 2924 | (funcall this-shell-command-to-string "set"))))))))) |
| 2922 | 2925 | ||
| 2926 | ;; This test is inspired by Bug#27009. | ||
| 2927 | (ert-deftest tramp-test29-environment-variables-and-port-numbers () | ||
| 2928 | "Check that two connections with separate ports are different." | ||
| 2929 | ;; Mark as failed until bug has been fixed. | ||
| 2930 | :expected-result :failed | ||
| 2931 | (skip-unless (tramp--test-enabled)) | ||
| 2932 | ;; We test it only for the mock-up connection; otherwise there might | ||
| 2933 | ;; be problems with the used ports. | ||
| 2934 | (skip-unless | ||
| 2935 | (and | ||
| 2936 | (eq tramp-syntax 'default) | ||
| 2937 | (string-equal | ||
| 2938 | "mock" (file-remote-p tramp-test-temporary-file-directory 'method)))) | ||
| 2939 | |||
| 2940 | ;; We force a reconnect, in order to have a clean environment. | ||
| 2941 | (dolist (dir | ||
| 2942 | `(,tramp-test-temporary-file-directory | ||
| 2943 | "/mock:localhost#11111:" "/mock:localhost#22222:")) | ||
| 2944 | (tramp-cleanup-connection | ||
| 2945 | (tramp-dissect-file-name dir) 'keep-debug 'keep-password)) | ||
| 2946 | |||
| 2947 | (dolist (port '(11111 22222)) | ||
| 2948 | (let* ((default-directory | ||
| 2949 | (format "/mock:localhost#%d:%s" port temporary-file-directory)) | ||
| 2950 | (shell-file-name "/bin/sh") | ||
| 2951 | (envvar (concat "VAR_" (upcase (md5 (current-time-string))))) | ||
| 2952 | ;; We cannot use `process-environment', because this would | ||
| 2953 | ;; be applied in `process-file'. | ||
| 2954 | (tramp-remote-process-environment | ||
| 2955 | (cons | ||
| 2956 | (format "%s=%d" envvar port) tramp-remote-process-environment))) | ||
| 2957 | (should | ||
| 2958 | (string-equal | ||
| 2959 | (number-to-string port) | ||
| 2960 | (shell-command-to-string (format "echo -n $%s" envvar))))))) | ||
| 2961 | |||
| 2923 | ;; The functions were introduced in Emacs 26.1. | 2962 | ;; The functions were introduced in Emacs 26.1. |
| 2924 | (ert-deftest tramp-test30-explicit-shell-file-name () | 2963 | (ert-deftest tramp-test30-explicit-shell-file-name () |
| 2925 | "Check that connection-local `explicit-shell-file-name' is set." | 2964 | "Check that connection-local `explicit-shell-file-name' is set." |
| @@ -3766,6 +3805,8 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 3766 | ;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'. | 3805 | ;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'. |
| 3767 | ;; * Fix `tramp-test06-directory-file-name' for `ftp'. | 3806 | ;; * Fix `tramp-test06-directory-file-name' for `ftp'. |
| 3768 | ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). | 3807 | ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?). |
| 3808 | ;; * Fix Bug#27009. Set expected error of | ||
| 3809 | ;; `tramp-test29-environment-variables-and-port-numbers'. | ||
| 3769 | ;; * Fix Bug#16928. Set expected error of `tramp-test36-asynchronous-requests'. | 3810 | ;; * Fix Bug#16928. Set expected error of `tramp-test36-asynchronous-requests'. |
| 3770 | ;; * Fix `tramp-test38-unload' (Not all symbols are unbound). Set | 3811 | ;; * Fix `tramp-test38-unload' (Not all symbols are unbound). Set |
| 3771 | ;; expected error. | 3812 | ;; expected error. |