]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix tramp-sshfs
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 11 Jun 2023 18:33:34 +0000 (20:33 +0200)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 11 Jun 2023 18:33:34 +0000 (20:33 +0200)
* lisp/net/tramp-fuse.el (tramp-fuse-handle-file-exists-p): New defun.
(tramp-fuse-mount-timeout): Move up.
(tramp-fuse-mount-point): Use `tramp-fuse-mount-timeout'.
(tramp-fuse-unmount): Flush "mount-point" file property.

* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-fuse-handle-file-exists-p'.

* test/lisp/net/tramp-tests.el (all): Use function read syntax
where appropriate.
(tramp-test39-detect-external-change): Let-bind
`read-from-minibuffer' instead of `yes-or-no-p'.

lisp/net/tramp-fuse.el
lisp/net/tramp-sshfs.el
test/lisp/net/tramp-tests.el

index 8626610211ad55f42c258f19391d6994b548a12a..99360c2c28e14ca7c771999651f0c16f08a589ba 100644 (file)
     (with-tramp-file-property v localname "file-executable-p"
       (file-executable-p (tramp-fuse-local-file-name filename)))))
 
+(defun tramp-fuse-handle-file-exists-p (filename)
+  "Like `file-exists-p' for Tramp files."
+  (tramp-skeleton-file-exists-p filename
+    (file-exists-p (tramp-fuse-local-file-name filename))))
+
 (defun tramp-fuse-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for Tramp files."
   (tramp-fuse-remove-hidden-files
       (format "%s@%s:/" user host)
     (format "%s:/" host)))
 
-(defun tramp-fuse-mount-point (vec)
-  "Return local mount point of VEC."
-  (or (tramp-get-file-property vec "/" "mount-point")
-      (expand-file-name
-       (concat
-       tramp-temp-name-prefix
-       (tramp-file-name-method vec) "."
-       (when (tramp-file-name-user vec)
-         (concat (tramp-file-name-user-domain vec) "@"))
-       (tramp-file-name-host-port vec))
-       (or small-temporary-file-directory
-          tramp-compat-temporary-file-directory))))
-
 (defconst tramp-fuse-mount-timeout
   (eval (car (get 'remote-file-name-inhibit-cache 'standard-value)) t)
   "Time period to check whether the mount point still exists.
 It has the same meaning as `remote-file-name-inhibit-cache'.")
 
+(defun tramp-fuse-mount-point (vec)
+  "Return local mount point of VEC."
+  (let ((remote-file-name-inhibit-cache tramp-fuse-mount-timeout))
+    (or (tramp-get-file-property vec "/" "mount-point")
+       (expand-file-name
+        (concat
+         tramp-temp-name-prefix
+         (tramp-file-name-method vec) "."
+         (when (tramp-file-name-user vec)
+           (concat (tramp-file-name-user-domain vec) "@"))
+         (tramp-file-name-host-port vec))
+        tramp-compat-temporary-file-directory))))
+
 (defun tramp-fuse-mounted-p (vec)
   "Check, whether fuse volume determined by VEC is mounted."
   ;; Remember the mount status by using a file property on "/",
@@ -198,6 +203,7 @@ It has the same meaning as `remote-file-name-inhibit-cache'.")
          (command (format "%s -u %s" (tramp-fuse-get-fusermount) mount-point)))
     (tramp-message vec 6 "%s\n%s" command (shell-command-to-string command))
     (tramp-flush-file-property vec "/" "mounted")
+    (tramp-flush-file-property vec "/" "mount-point")
     (setq tramp-fuse-mount-points
          (delete (tramp-file-name-unify vec) tramp-fuse-mount-points))
     ;; Give the caches a chance to expire.
index 9d871276f7a5287dea4d469b647613bab5c73b16..e3c9e0b53b23c1d48f196da389999e3afa68f2a8 100644 (file)
     (file-directory-p . tramp-handle-file-directory-p)
     (file-equal-p . tramp-handle-file-equal-p)
     (file-executable-p . tramp-fuse-handle-file-executable-p)
-    (file-exists-p . tramp-handle-file-exists-p)
+    (file-exists-p . tramp-fuse-handle-file-exists-p)
     (file-group-gid . tramp-handle-file-group-gid)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
     (file-local-copy . tramp-handle-file-local-copy)
index 017cb73f3bbf1535c07e3405174c752585c80e2d..0b01c13470a4036f0246409157c7131315a06afc 100644 (file)
@@ -2559,7 +2559,7 @@ This checks also `file-name-as-directory', `file-name-directory',
            ;; Do not overwrite if excluded.
            (cl-letf (((symbol-function #'y-or-n-p) #'tramp-compat-always)
                      ;; Ange-FTP.
-                     ((symbol-function 'yes-or-no-p) #'tramp-compat-always))
+                     ((symbol-function #'yes-or-no-p) #'tramp-compat-always))
              (write-region "foo" nil tmp-name nil nil nil 'mustbenew))
            (should-error
             (cl-letf (((symbol-function #'y-or-n-p) #'ignore)
@@ -6737,8 +6737,9 @@ INPUT, if non-nil, is a string sent to the process."
                (insert "foo")
                ;; Bug#53207: with `create-lockfiles' nil, saving the
                ;; buffer results in a prompt.
-               (cl-letf (((symbol-function 'yes-or-no-p)
-                          (lambda (_) (ert-fail "Test failed unexpectedly"))))
+               (cl-letf (((symbol-function #'read-from-minibuffer)
+                          (lambda (&rest _)
+                            (ert-fail "Test failed unexpectedly"))))
                  (should (buffer-modified-p))
                  (save-buffer)
                  (should-not (buffer-modified-p)))
@@ -6756,7 +6757,7 @@ INPUT, if non-nil, is a string sent to the process."
                ;; modification time properly, for them it doesn't
                ;; make sense to test.
                (when (not (verify-visited-file-modtime))
-                 (cl-letf (((symbol-function 'read-char-choice)
+                 (cl-letf (((symbol-function #'read-char-choice)
                             (lambda (prompt &rest _) (message "%s" prompt) ?y)))
                    (ert-with-message-capture captured-messages
                      (insert "bar")
@@ -6772,9 +6773,9 @@ INPUT, if non-nil, is a string sent to the process."
                        (should (file-locked-p tmp-name)))))
 
                  ;; `save-buffer' removes the file lock.
-                 (cl-letf (((symbol-function 'yes-or-no-p)
+                 (cl-letf (((symbol-function #'yes-or-no-p)
                             #'tramp-compat-always)
-                           ((symbol-function 'read-char-choice)
+                           ((symbol-function #'read-char-choice)
                             (lambda (&rest _) ?y)))
                    (should (buffer-modified-p))
                    (save-buffer)