[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8737d79be8: Fix problem with file-modification-time in tramp-sshf
From: |
Michael Albinus |
Subject: |
master 8737d79be8: Fix problem with file-modification-time in tramp-sshfs.el |
Date: |
Wed, 16 Feb 2022 14:22:57 -0500 (EST) |
branch: master
commit 8737d79be8f82bb12ca12dc1a7de37a4d2875f39
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Fix problem with file-modification-time in tramp-sshfs.el
* lisp/net/tramp-crypt.el (tramp-crypt-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
* lisp/net/tramp-sshfs.el (tramp-sshfs-file-name-handler-alist):
Use `tramp-handle-file-notify-add-watch',
`tramp-handle-file-notify-rm-watch' and
`tramp-handle-file-notify-valid-p'.
(tramp-sshfs-handle-write-region): Set file modification time.
(Bug#54016)
* test/lisp/net/tramp-tests.el (tramp--test-asynchronous-processes-p):
Filter out tramp-adb on multi-byte `default-directory'.
(tramp--test-hpux-p, tramp--test-macos-p): Protect against errors.
(tramp--test-check-files): Discriminate also tramp-sshfs.el.
---
lisp/net/tramp-crypt.el | 6 +++---
lisp/net/tramp-rclone.el | 6 +++---
lisp/net/tramp-sshfs.el | 12 +++++++++---
lisp/net/tramp-sudoedit.el | 6 +++---
test/lisp/net/tramp-tests.el | 20 +++++++++++++-------
5 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el
index 2a6db03672..47c707451e 100644
--- a/lisp/net/tramp-crypt.el
+++ b/lisp/net/tramp-crypt.el
@@ -193,9 +193,9 @@ If NAME doesn't belong to a crypted remote directory, retun
nil."
;; `file-name-nondirectory' performed by default handler.
;; `file-name-sans-versions' performed by default handler.
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
- (file-notify-add-watch . ignore)
- (file-notify-rm-watch . ignore)
- (file-notify-valid-p . ignore)
+ (file-notify-add-watch . tramp-handle-file-notify-add-watch)
+ (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
+ (file-notify-valid-p . tramp-handle-file-notify-valid-p)
(file-ownership-preserved-p .
tramp-crypt-handle-file-ownership-preserved-p)
(file-readable-p . tramp-crypt-handle-file-readable-p)
(file-regular-p . tramp-handle-file-regular-p)
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 259e85a04a..32ec19bf23 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -107,9 +107,9 @@
(file-name-nondirectory . tramp-handle-file-name-nondirectory)
;; `file-name-sans-versions' performed by default handler.
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
- (file-notify-add-watch . ignore)
- (file-notify-rm-watch . ignore)
- (file-notify-valid-p . ignore)
+ (file-notify-add-watch . tramp-handle-file-notify-add-watch)
+ (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
+ (file-notify-valid-p . tramp-handle-file-notify-valid-p)
(file-ownership-preserved-p . ignore)
(file-readable-p . tramp-rclone-handle-file-readable-p)
(file-regular-p . tramp-handle-file-regular-p)
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 40c02ccea0..d30c19436d 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -108,9 +108,9 @@
(file-name-nondirectory . tramp-handle-file-name-nondirectory)
;; `file-name-sans-versions' performed by default handler.
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
- (file-notify-add-watch . ignore)
- (file-notify-rm-watch . ignore)
- (file-notify-valid-p . ignore)
+ (file-notify-add-watch . tramp-handle-file-notify-add-watch)
+ (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
+ (file-notify-valid-p . tramp-handle-file-notify-valid-p)
(file-ownership-preserved-p . ignore)
(file-readable-p . tramp-handle-file-readable-p)
(file-regular-p . tramp-handle-file-regular-p)
@@ -389,6 +389,12 @@ arguments to pass to the OPERATION."
start end (tramp-fuse-local-file-name filename) append 'nomessage)
(tramp-flush-file-properties v localname))
+ ;; Set file modification time.
+ (when (or (eq visit t) (stringp visit))
+ (set-visited-file-modtime
+ (or (file-attribute-modification-time (file-attributes filename))
+ (current-time))))
+
;; Unlock file.
(when file-locked
;; `unlock-file' exists since Emacs 28.1.
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 7fbe541270..797804dfd4 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -100,9 +100,9 @@ See `tramp-actions-before-shell' for more info.")
(file-name-nondirectory . tramp-handle-file-name-nondirectory)
;; `file-name-sans-versions' performed by default handler.
(file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
- (file-notify-add-watch . ignore)
- (file-notify-rm-watch . ignore)
- (file-notify-valid-p . ignore)
+ (file-notify-add-watch . tramp-handle-file-notify-add-watch)
+ (file-notify-rm-watch . tramp-handle-file-notify-rm-watch)
+ (file-notify-valid-p . tramp-handle-file-notify-valid-p)
(file-ownership-preserved-p . ignore)
(file-readable-p . tramp-sudoedit-handle-file-readable-p)
(file-regular-p . tramp-handle-file-regular-p)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index baddcd2d7a..2ce7881543 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -6198,10 +6198,14 @@ This requires restrictions of file name syntax."
"Whether asynchronous processes tests are run.
This is used in tests which we dont't want to tag
`:tramp-asynchronous-processes' completely."
- (ert-select-tests
- (ert--stats-selector ert--current-run-stats)
- (list (make-ert-test :name (ert-test-name (ert-running-test))
- :body nil :tags '(:tramp-asynchronous-processes)))))
+ (and
+ (ert-select-tests
+ (ert--stats-selector ert--current-run-stats)
+ (list (make-ert-test :name (ert-test-name (ert-running-test))
+ :body nil :tags '(:tramp-asynchronous-processes))))
+ ;; tramp-adb.el cannot apply multi-byte commands.
+ (not (and (tramp--test-adb-p)
+ (string-match-p "[[:multibyte:]]" default-directory)))))
(defun tramp--test-crypt-p ()
"Check, whether the remote directory is crypted."
@@ -6250,7 +6254,7 @@ If optional METHOD is given, it is checked first."
Several special characters do not work properly there."
;; We must refill the cache. `file-truename' does it.
(file-truename tramp-test-temporary-file-directory)
- (tramp-check-remote-uname tramp-test-vec "^HP-UX"))
+ (ignore-errors (tramp-check-remote-uname tramp-test-vec "^HP-UX")))
(defun tramp--test-ksh-p ()
"Check, whether the remote shell is ksh.
@@ -6265,7 +6269,7 @@ a $'' syntax."
"Check, whether the remote host runs macOS."
;; We must refill the cache. `file-truename' does it.
(file-truename tramp-test-temporary-file-directory)
- (tramp-check-remote-uname tramp-test-vec "Darwin"))
+ (ignore-errors (tramp-check-remote-uname tramp-test-vec "Darwin")))
(defun tramp--test-mock-p ()
"Check, whether the mock method is used.
@@ -6527,8 +6531,10 @@ This requires restrictions of file name syntax."
;; Prior Emacs 27, `shell-file-name' was
;; hard coded as "/bin/sh" for remote
;; processes in Emacs. That doesn't work
- ;; for tramp-adb.el.
+ ;; for tramp-adb.el. tramp-sshfs.el times
+ ;; out for older Emacsen, reason unknown.
(or (not (tramp--test-adb-p))
+ (not (tramp--test-sshfs-p))
(tramp--test-emacs27-p)))
(let ((default-directory file1))
(dolist (this-shell-command
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8737d79be8: Fix problem with file-modification-time in tramp-sshfs.el,
Michael Albinus <=