aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2017-11-18 14:24:03 +0100
committerMichael Albinus2017-11-18 14:24:03 +0100
commitc355529baedf3a5f03a8a4ee5904a5918f456b64 (patch)
treeba8058621743277be10798e2099fd3589c0c88d9
parent4c21d04057d5f4f801d57e8aa2ffdab834ddc48a (diff)
downloademacs-c355529baedf3a5f03a8a4ee5904a5918f456b64.tar.gz
emacs-c355529baedf3a5f03a8a4ee5904a5918f456b64.zip
Fix bug in tramp-handle-file-truename
* lisp/net/tramp.el (tramp-handle-file-truename): Expand localname. * test/lisp/net/tramp-tests.el (tramp-test21-file-links): Check also relative symbolic links.
-rw-r--r--lisp/net/tramp.el3
-rw-r--r--test/lisp/net/tramp-tests.el11
2 files changed, 12 insertions, 2 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3d5dcbdbb14..aadfcadebcf 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3207,7 +3207,8 @@ User is always nil."
3207 (if (file-remote-p symlink-target) 3207 (if (file-remote-p symlink-target)
3208 (let (file-name-handler-alist) 3208 (let (file-name-handler-alist)
3209 (tramp-compat-file-name-quote symlink-target)) 3209 (tramp-compat-file-name-quote symlink-target))
3210 symlink-target) 3210 (expand-file-name
3211 symlink-target (file-name-directory v2-localname)))
3211 v2-localname))))) 3212 v2-localname)))))
3212 (when (>= numchase numchase-limit) 3213 (when (>= numchase numchase-limit)
3213 (tramp-error 3214 (tramp-error
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index cf85b071e19..62f72a3f6f6 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2671,7 +2671,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2671 (should-error 2671 (should-error
2672 (make-symbolic-link tmp-name1 tmp-name2) 2672 (make-symbolic-link tmp-name1 tmp-name2)
2673 :type 'file-already-exists) 2673 :type 'file-already-exists)
2674 ;; number means interactive case. 2674 ;; A number means interactive case.
2675 (cl-letf (((symbol-function 'yes-or-no-p) 'ignore)) 2675 (cl-letf (((symbol-function 'yes-or-no-p) 'ignore))
2676 (should-error 2676 (should-error
2677 (make-symbolic-link tmp-name1 tmp-name2 0) 2677 (make-symbolic-link tmp-name1 tmp-name2 0)
@@ -2783,6 +2783,15 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
2783 (should 2783 (should
2784 (string-equal (file-truename tmp-name1) (file-truename tmp-name2))) 2784 (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
2785 (should (file-equal-p tmp-name1 tmp-name2)) 2785 (should (file-equal-p tmp-name1 tmp-name2))
2786 ;; Check relative symlink file name.
2787 (delete-file tmp-name2)
2788 (let ((default-directory tramp-test-temporary-file-directory))
2789 (make-symbolic-link (file-name-nondirectory tmp-name1) tmp-name2))
2790 (should (file-symlink-p tmp-name2))
2791 (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
2792 (should
2793 (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
2794 (should (file-equal-p tmp-name1 tmp-name2))
2786 ;; Symbolic links could look like a remote file name. 2795 ;; Symbolic links could look like a remote file name.
2787 ;; They must be quoted then. 2796 ;; They must be quoted then.
2788 (delete-file tmp-name2) 2797 (delete-file tmp-name2)