summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2016-11-09 15:34:40 +0100
committerMichael Albinus <michael.albinus@gmx.de>2016-11-09 15:34:40 +0100
commitdba9bc9752f62c782853c7a652e84e33f0649c3b (patch)
treeb564b972c121e0c167bc923fc9b7d60337d8c973
parent112111c4e489aae5cbe241ffa458d97b6a133d3a (diff)
downloademacs-dba9bc9752f62c782853c7a652e84e33f0649c3b.tar.gz
emacs-dba9bc9752f62c782853c7a652e84e33f0649c3b.tar.bz2
emacs-dba9bc9752f62c782853c7a652e84e33f0649c3b.zip
Refine multi-hop specs in Tramp
* lisp/net/tramp.el (tramp-tramp-file-p): Suppress "/:" and "/c:". * test/lisp/net/tramp-tests.el (tramp-test01-file-name-syntax): Multi-hop specs don't need a method. "/h:" is allowed on non MS Windows.
-rw-r--r--lisp/net/tramp.el5
-rw-r--r--test/lisp/net/tramp-tests.el13
2 files changed, 13 insertions, 5 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 8a81311508f..00ecb375c59 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1146,6 +1146,11 @@ entry does not exist, return nil."
"Return t if NAME is a string with Tramp file name syntax."
(save-match-data
(and (stringp name)
+ ;; No "/:" and "/c:". This is not covered by `tramp-file-name-regexp'.
+ (not (string-match
+ (if (memq system-type '(cygwin windows-nt))
+ "^/[[:alpha:]]?:" "^/:")
+ name))
(string-match tramp-file-name-regexp name))))
(defun tramp-find-method (method user host)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 5d9d3a039b6..4c3b83cdcd1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -185,6 +185,8 @@ handled properly. BODY shall not contain a timeout."
(should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:"))
(should (tramp-tramp-file-p
"/method1:user1@host1|method2:user2@host2|method3:user3@host3:"))
+ (should (tramp-tramp-file-p "/host1|host2:"))
+ (should (tramp-tramp-file-p "/user1@host1|user2@host2:"))
;; No strings.
(should-not (tramp-tramp-file-p nil))
@@ -193,12 +195,13 @@ handled properly. BODY shall not contain a timeout."
(should-not (tramp-tramp-file-p "/::"))
(should-not (tramp-tramp-file-p "/:@:"))
(should-not (tramp-tramp-file-p "/:[]:"))
- ;; Multihops require a method.
- (should-not (tramp-tramp-file-p "/host1|host2:"))
;; Methods or hostnames shall be at least two characters on MS Windows.
- (when (memq system-type '(cygwin windows-nt))
- (should-not (tramp-tramp-file-p "/c:/path/to/file"))
- (should-not (tramp-tramp-file-p "/c::/path/to/file"))))
+ (let ((system-type 'windows-nt))
+ (should-not (tramp-tramp-file-p "/c:/path/to/file"))
+ (should-not (tramp-tramp-file-p "/c::/path/to/file")))
+ (let ((system-type 'gnu/linux))
+ (should (tramp-tramp-file-p "/h:/path/to/file"))
+ (should (tramp-tramp-file-p "/m::/path/to/file"))))
(ert-deftest tramp-test02-file-name-dissect ()
"Check remote file name components."