diff options
| author | Michael Albinus | 2018-03-29 15:59:11 +0200 |
|---|---|---|
| committer | Michael Albinus | 2018-03-29 15:59:11 +0200 |
| commit | b9340aad7961c57fbd458d52e813b71f09aaa45f (patch) | |
| tree | e1ea831aa4368db4869712f11d8a1cf89e2d1b43 /test/lisp | |
| parent | 9ad3560db6b67777bc8f9b370e053b6a19a7501f (diff) | |
| download | emacs-b9340aad7961c57fbd458d52e813b71f09aaa45f.tar.gz emacs-b9340aad7961c57fbd458d52e813b71f09aaa45f.zip | |
Fix Bug#30946
* doc/misc/tramp.texi (Multi-hops): Mention host name checks.
* lisp/net/tramp.el (tramp-set-syntax, tramp-dissect-file-name)
(tramp-debug-message, tramp-handle-shell-command):
* lisp/net/tramp-adb.el (tramp-adb-handle-shell-command):
* lisp/net/tramp-archive.el (tramp-archive-file-name-handler)
(tramp-archive-dissect-file-name):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler): Adapt callees.
* lisp/net/tramp-compat.el (tramp-compat-user-error): Move defsubst ---
* lisp/net/tramp-sh.el (tramp-compute-multi-hops): Check for proper
host names in multi-hop. (Bug#30946)
* lisp/net/tramp.el (tramp-user-error): ... here. Make it a defun.
* test/lisp/net/tramp-tests.el (tramp-test03-file-name-host-rules):
New test.
Diffstat (limited to 'test/lisp')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index dfb01126f70..5e79a4bce6f 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -1722,6 +1722,28 @@ handled properly. BODY shall not contain a timeout." | |||
| 1722 | ;; Default values in tramp-smb.el. | 1722 | ;; Default values in tramp-smb.el. |
| 1723 | (should (string-equal (file-remote-p "/smb::" 'user) nil))) | 1723 | (should (string-equal (file-remote-p "/smb::" 'user) nil))) |
| 1724 | 1724 | ||
| 1725 | ;; The following test is inspired by Bug#30946. | ||
| 1726 | (ert-deftest tramp-test03-file-name-host-rules () | ||
| 1727 | "Check host name rules for host-less methods." | ||
| 1728 | (skip-unless (tramp--test-enabled)) | ||
| 1729 | (skip-unless (tramp--test-sh-p)) | ||
| 1730 | |||
| 1731 | ;; Host names must match rules in case the command template of a | ||
| 1732 | ;; method doesn't use them. | ||
| 1733 | (dolist (m '("su" "sg" "sudo" "doas" "ksu")) | ||
| 1734 | ;; Single hop. The host name must match `tramp-local-host-regexp'. | ||
| 1735 | (should-error | ||
| 1736 | (find-file (format "/%s:foo:" m)) | ||
| 1737 | :type 'user-error) | ||
| 1738 | ;; Multi hop. The host name must match the previous hop. | ||
| 1739 | (should-error | ||
| 1740 | (find-file | ||
| 1741 | (format | ||
| 1742 | "%s|%s:foo:" | ||
| 1743 | (substring (file-remote-p tramp-test-temporary-file-directory) nil -1) | ||
| 1744 | m)) | ||
| 1745 | :type 'user-error))) | ||
| 1746 | |||
| 1725 | (ert-deftest tramp-test04-substitute-in-file-name () | 1747 | (ert-deftest tramp-test04-substitute-in-file-name () |
| 1726 | "Check `substitute-in-file-name'." | 1748 | "Check `substitute-in-file-name'." |
| 1727 | (should (string-equal (substitute-in-file-name "/method:host:///foo") "/foo")) | 1749 | (should (string-equal (substitute-in-file-name "/method:host:///foo") "/foo")) |
| @@ -1836,6 +1858,7 @@ handled properly. BODY shall not contain a timeout." | |||
| 1836 | ;; Mark as failed until bug has been fixed. | 1858 | ;; Mark as failed until bug has been fixed. |
| 1837 | :expected-result :failed | 1859 | :expected-result :failed |
| 1838 | (skip-unless (tramp--test-enabled)) | 1860 | (skip-unless (tramp--test-enabled)) |
| 1861 | |||
| 1839 | ;; These are the methods the test doesn't fail. | 1862 | ;; These are the methods the test doesn't fail. |
| 1840 | (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) | 1863 | (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) |
| 1841 | (tramp-smb-file-name-p tramp-test-temporary-file-directory)) | 1864 | (tramp-smb-file-name-p tramp-test-temporary-file-directory)) |