emacs-diffs
[Top][All Lists]
Advanced

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

master 2db149539b: Fix symlinks in tramp-sshfs.el (Bug#54130)


From: Michael Albinus
Subject: master 2db149539b: Fix symlinks in tramp-sshfs.el (Bug#54130)
Date: Thu, 24 Feb 2022 10:11:11 -0500 (EST)

branch: master
commit 2db149539bc7f9720856f1d17f0e7fa9bf735ea1
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Fix symlinks in tramp-sshfs.el  (Bug#54130)
    
    * lisp/net/tramp-sshfs.el (tramp-methods) <sshfs>:
    Add "-o transform_symlinks" to `tramp-mount-args'.
    (tramp-sshfs-file-name-handler-alist):
    Use `tramp-sshfs-handle-file-writable-p'.
    (tramp-sshfs-handle-file-writable-p): New defun.  (Bug#54130)
    
    * test/lisp/net/tramp-tests.el (tramp-test18-file-attributes)
    (tramp-test20-file-modes): Adapt tests.
---
 lisp/net/tramp-sshfs.el      |  9 +++++++--
 test/lisp/net/tramp-tests.el | 10 +++++++---
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index d30c19436d..90b3c2ba2c 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -51,10 +51,11 @@
  (add-to-list 'tramp-methods
              `(,tramp-sshfs-method
                (tramp-mount-args            (("-C") ("-p" "%p")
+                                             ("-o" "transform_symlinks")
                                              ("-o" "idmap=user,reconnect")))
                ;; These are for remote processes.
                 (tramp-login-program        "ssh")
-                (tramp-login-args           (("-q")("-l" "%u") ("-p" "%p")
+                (tramp-login-args           (("-q") ("-l" "%u") ("-p" "%p")
                                             ("-e" "none") ("-t" "-t")
                                             ("%h") ("%l")))
                 (tramp-direct-async         t)
@@ -119,7 +120,7 @@
     (file-symlink-p . tramp-handle-file-symlink-p)
     (file-system-info . tramp-sshfs-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
-    (file-writable-p . tramp-handle-file-writable-p)
+    (file-writable-p . tramp-sshfs-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
     ;; `get-file-buffer' performed by default handler.
     (insert-directory . tramp-handle-insert-directory)
@@ -220,6 +221,10 @@ arguments to pass to the OPERATION."
   ;;`file-system-info' exists since Emacs 27.1.
   (tramp-compat-funcall 'file-system-info (tramp-fuse-local-file-name 
filename)))
 
+(defun tramp-sshfs-handle-file-writable-p (filename)
+  "Like `file-writable-p' for Tramp files."
+  (file-writable-p (tramp-fuse-local-file-name filename)))
+
 (defun tramp-sshfs-handle-insert-file-contents
   (filename &optional visit beg end replace)
   "Like `insert-file-contents' for Tramp files."
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 4e74f2aa73..c468c3501b 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -3437,8 +3437,10 @@ This tests also `access-file', `file-readable-p',
              (should
               (string-equal
                (file-attribute-type attr)
-               (tramp-file-name-localname
-                (tramp-dissect-file-name tmp-name3))))
+               (funcall
+                (if (tramp--test-sshfs-p) #'file-name-nondirectory #'identity)
+                (tramp-file-name-localname
+                 (tramp-dissect-file-name tmp-name3)))))
              (delete-file tmp-name2))
 
            (when test-file-ownership-preserved-p
@@ -3598,7 +3600,9 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
            (should (= (file-modes tmp-name1) #o444))
            (should-not (file-executable-p tmp-name1))
            ;; A file is always writable for user "root".
-           (unless (zerop (file-attribute-user-id (file-attributes tmp-name1)))
+           (unless
+               (or (zerop (file-attribute-user-id (file-attributes tmp-name1)))
+                   (tramp--test-sshfs-p))
              (should-not (file-writable-p tmp-name1)))
            ;; Check the NOFOLLOW arg.  It exists since Emacs 28.  For
            ;; regular files, there shouldn't be a difference.



reply via email to

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