emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-26 c355529: Fix bug in tramp-handle-file-truename


From: Michael Albinus
Subject: [Emacs-diffs] emacs-26 c355529: Fix bug in tramp-handle-file-truename
Date: Sat, 18 Nov 2017 08:24:12 -0500 (EST)

branch: emacs-26
commit c355529baedf3a5f03a8a4ee5904a5918f456b64
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    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.
---
 lisp/net/tramp.el            |  3 ++-
 test/lisp/net/tramp-tests.el | 11 ++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3d5dcbd..aadfcad 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3207,7 +3207,8 @@ User is always nil."
                         (if (file-remote-p symlink-target)
                             (let (file-name-handler-alist)
                               (tramp-compat-file-name-quote symlink-target))
-                          symlink-target)
+                          (expand-file-name
+                           symlink-target (file-name-directory v2-localname)))
                       v2-localname)))))
           (when (>= numchase numchase-limit)
             (tramp-error
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index cf85b07..62f72a3 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'."
            (should-error
             (make-symbolic-link tmp-name1 tmp-name2)
             :type 'file-already-exists)
-           ;; number means interactive case.
+           ;; A number means interactive case.
            (cl-letf (((symbol-function 'yes-or-no-p) 'ignore))
              (should-error
               (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'."
            (should
             (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
            (should (file-equal-p tmp-name1 tmp-name2))
+           ;; Check relative symlink file name.
+           (delete-file tmp-name2)
+           (let ((default-directory tramp-test-temporary-file-directory))
+             (make-symbolic-link (file-name-nondirectory tmp-name1) tmp-name2))
+           (should (file-symlink-p tmp-name2))
+           (should-not (string-equal tmp-name2 (file-truename tmp-name2)))
+           (should
+            (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))
+           (should (file-equal-p tmp-name1 tmp-name2))
            ;; Symbolic links could look like a remote file name.
            ;; They must be quoted then.
            (delete-file tmp-name2)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]