aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2019-08-05 13:09:26 +0200
committerMichael Albinus2019-08-05 13:09:26 +0200
commit6c1d0d53b34d9350d55ebbd83ea56aa751a55f1b (patch)
treecd7a17c72e10ef68d048d17088662cb579644aba /lisp
parent1abf76877847226daa5ab7e07000ac1d4aba3478 (diff)
downloademacs-6c1d0d53b34d9350d55ebbd83ea56aa751a55f1b.tar.gz
emacs-6c1d0d53b34d9350d55ebbd83ea56aa751a55f1b.zip
Improve Tramp's caching
* lisp/net/tramp.el (tramp-handle-add-name-to-file) (tramp-handle-write-region): * lisp/net/tramp-adb.el (tramp-adb-handle-make-directory) (tramp-adb-handle-delete-directory) (tramp-adb-handle-delete-file, tramp-adb-handle-write-region) (tramp-adb-handle-set-file-modes) (tramp-adb-handle-set-file-times, tramp-adb-handle-copy-file) (tramp-adb-handle-rename-file): * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file) (tramp-gvfs-handle-delete-directory) (tramp-gvfs-handle-delete-file) (tramp-gvfs-handle-make-directory) (tramp-gvfs-handle-set-file-modes) (tramp-gvfs-handle-set-file-times, tramp-gvfs-set-file-uid-gid): * lisp/net/tramp-rclone.el (tramp-rclone-do-copy-or-rename-file) (tramp-rclone-handle-delete-directory) (tramp-rclone-handle-delete-file): * lisp/net/tramp-sh.el (tramp-sh-handle-make-symbolic-link) (tramp-sh-handle-set-file-modes, tramp-sh-handle-set-file-times) (tramp-sh-handle-add-name-to-file) (tramp-sh-handle-copy-directory, tramp-do-copy-or-rename-file) (tramp-sh-handle-delete-directory, tramp-sh-handle-delete-file) (tramp-sh-handle-write-region): * lisp/net/tramp-smb.el (tramp-smb-handle-add-name-to-file) (tramp-smb-handle-copy-directory, tramp-smb-handle-copy-file) (tramp-smb-handle-delete-directory) (tramp-smb-handle-delete-file) (tramp-smb-handle-make-directory-internal) (tramp-smb-handle-make-symbolic-link) (tramp-smb-handle-rename-file, tramp-smb-handle-write-region): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-add-name-to-file) (tramp-sudoedit-do-copy-or-rename-file) (tramp-sudoedit-handle-delete-directory) (tramp-sudoedit-handle-delete-file) (tramp-sudoedit-handle-set-file-modes) (tramp-sudoedit-handle-set-file-times) (tramp-sudoedit-handle-make-symbolic-link): Do not flush all file properties of upper directory. * lisp/net/tramp-cache.el (tramp-flush-file-upper-properties): New defun. (tramp-flush-file-properties, tramp-flush-directory-properties): Use it. * test/lisp/net/tramp-tests.el (tramp-time-diff): Declare. (tramp--test-file-attributes-equal-p): Handle also modification and status change time.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp-adb.el12
-rw-r--r--lisp/net/tramp-cache.el24
-rw-r--r--lisp/net/tramp-gvfs.el8
-rw-r--r--lisp/net/tramp-rclone.el10
-rw-r--r--lisp/net/tramp-sh.el12
-rw-r--r--lisp/net/tramp-smb.el12
-rw-r--r--lisp/net/tramp-sudoedit.el10
-rw-r--r--lisp/net/tramp.el2
8 files changed, 22 insertions, 68 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index fb84aa11085..475f9a2e2b3 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -510,7 +510,6 @@ Emacs dired can't find files."
510 (let ((par (expand-file-name ".." dir))) 510 (let ((par (expand-file-name ".." dir)))
511 (unless (file-directory-p par) 511 (unless (file-directory-p par)
512 (make-directory par parents)))) 512 (make-directory par parents))))
513 (tramp-flush-file-properties v (file-name-directory localname))
514 (tramp-flush-directory-properties v localname) 513 (tramp-flush-directory-properties v localname)
515 (unless (or (tramp-adb-send-command-and-check 514 (unless (or (tramp-adb-send-command-and-check
516 v (format "mkdir %s" (tramp-shell-quote-argument localname))) 515 v (format "mkdir %s" (tramp-shell-quote-argument localname)))
@@ -521,10 +520,8 @@ Emacs dired can't find files."
521 "Like `delete-directory' for Tramp files." 520 "Like `delete-directory' for Tramp files."
522 (setq directory (expand-file-name directory)) 521 (setq directory (expand-file-name directory))
523 (with-parsed-tramp-file-name (file-truename directory) nil 522 (with-parsed-tramp-file-name (file-truename directory) nil
524 (tramp-flush-file-properties v (file-name-directory localname))
525 (tramp-flush-directory-properties v localname)) 523 (tramp-flush-directory-properties v localname))
526 (with-parsed-tramp-file-name directory nil 524 (with-parsed-tramp-file-name directory nil
527 (tramp-flush-file-properties v (file-name-directory localname))
528 (tramp-flush-directory-properties v localname) 525 (tramp-flush-directory-properties v localname)
529 (tramp-adb-barf-unless-okay 526 (tramp-adb-barf-unless-okay
530 v (format "%s %s" 527 v (format "%s %s"
@@ -536,7 +533,6 @@ Emacs dired can't find files."
536 "Like `delete-file' for Tramp files." 533 "Like `delete-file' for Tramp files."
537 (setq filename (expand-file-name filename)) 534 (setq filename (expand-file-name filename))
538 (with-parsed-tramp-file-name filename nil 535 (with-parsed-tramp-file-name filename nil
539 (tramp-flush-file-properties v (file-name-directory localname))
540 (tramp-flush-file-properties v localname) 536 (tramp-flush-file-properties v localname)
541 (tramp-adb-barf-unless-okay 537 (tramp-adb-barf-unless-okay
542 v (format "rm %s" (tramp-shell-quote-argument localname)) 538 v (format "rm %s" (tramp-shell-quote-argument localname))
@@ -627,7 +623,6 @@ But handle the case, if the \"test\" command is not available."
627 623
628 ;; We must also flush the cache of the directory, because 624 ;; We must also flush the cache of the directory, because
629 ;; `file-attributes' reads the values from there. 625 ;; `file-attributes' reads the values from there.
630 (tramp-flush-file-properties v (file-name-directory localname))
631 (tramp-flush-file-properties v localname) 626 (tramp-flush-file-properties v localname)
632 (let* ((curbuf (current-buffer)) 627 (let* ((curbuf (current-buffer))
633 (tmpfile (tramp-compat-make-temp-file filename))) 628 (tmpfile (tramp-compat-make-temp-file filename)))
@@ -665,14 +660,12 @@ But handle the case, if the \"test\" command is not available."
665(defun tramp-adb-handle-set-file-modes (filename mode) 660(defun tramp-adb-handle-set-file-modes (filename mode)
666 "Like `set-file-modes' for Tramp files." 661 "Like `set-file-modes' for Tramp files."
667 (with-parsed-tramp-file-name filename nil 662 (with-parsed-tramp-file-name filename nil
668 (tramp-flush-file-properties v (file-name-directory localname))
669 (tramp-flush-file-properties v localname) 663 (tramp-flush-file-properties v localname)
670 (tramp-adb-send-command-and-check v (format "chmod %o %s" mode localname)))) 664 (tramp-adb-send-command-and-check v (format "chmod %o %s" mode localname))))
671 665
672(defun tramp-adb-handle-set-file-times (filename &optional time) 666(defun tramp-adb-handle-set-file-times (filename &optional time)
673 "Like `set-file-times' for Tramp files." 667 "Like `set-file-times' for Tramp files."
674 (with-parsed-tramp-file-name filename nil 668 (with-parsed-tramp-file-name filename nil
675 (tramp-flush-file-properties v (file-name-directory localname))
676 (tramp-flush-file-properties v localname) 669 (tramp-flush-file-properties v localname)
677 (let ((time (if (or (null time) 670 (let ((time (if (or (null time)
678 (tramp-compat-time-equal-p time tramp-time-doesnt-exist) 671 (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
@@ -722,7 +715,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
722 ;; We must also flush the cache of the directory, 715 ;; We must also flush the cache of the directory,
723 ;; because `file-attributes' reads the values from 716 ;; because `file-attributes' reads the values from
724 ;; there. 717 ;; there.
725 (tramp-flush-file-properties v (file-name-directory l2))
726 (tramp-flush-file-properties v l2) 718 (tramp-flush-file-properties v l2)
727 ;; Short track. 719 ;; Short track.
728 (tramp-adb-barf-unless-okay 720 (tramp-adb-barf-unless-okay
@@ -757,8 +749,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
757 ;; We must also flush the cache of the directory, 749 ;; We must also flush the cache of the directory,
758 ;; because `file-attributes' reads the values from 750 ;; because `file-attributes' reads the values from
759 ;; there. 751 ;; there.
760 (tramp-flush-file-properties
761 v (file-name-directory localname))
762 (tramp-flush-file-properties v localname) 752 (tramp-flush-file-properties v localname)
763 (when (tramp-adb-execute-adb-command 753 (when (tramp-adb-execute-adb-command
764 v "push" 754 v "push"
@@ -803,9 +793,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
803 (l2 (tramp-compat-file-local-name newname))) 793 (l2 (tramp-compat-file-local-name newname)))
804 ;; We must also flush the cache of the directory, because 794 ;; We must also flush the cache of the directory, because
805 ;; `file-attributes' reads the values from there. 795 ;; `file-attributes' reads the values from there.
806 (tramp-flush-file-properties v (file-name-directory l1))
807 (tramp-flush-file-properties v l1) 796 (tramp-flush-file-properties v l1)
808 (tramp-flush-file-properties v (file-name-directory l2))
809 (tramp-flush-file-properties v l2) 797 (tramp-flush-file-properties v l2)
810 ;; Short track. 798 ;; Short track.
811 (tramp-adb-barf-unless-okay 799 (tramp-adb-barf-unless-okay
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 40f74957f50..b52203c79cf 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -193,6 +193,22 @@ Returns VALUE."
193 (let ((var (intern (concat "tramp-cache-set-count-" property)))) 193 (let ((var (intern (concat "tramp-cache-set-count-" property))))
194 (makunbound var)))) 194 (makunbound var))))
195 195
196(defun tramp-flush-file-upper-properties (key file)
197 "Remove some properties of FILE's upper directory."
198 (when (file-name-absolute-p file)
199 (let ((file (directory-file-name (file-name-directory file))))
200 ;; Unify localname. Remove hop from `tramp-file-name' structure.
201 (setq file (tramp-compat-file-name-unquote file)
202 key (copy-tramp-file-name key))
203 (setf (tramp-file-name-localname key) file
204 (tramp-file-name-hop key) nil)
205 (maphash
206 (lambda (property _value)
207 (when (string-match-p
208 "^\\(directory-\\|file-name-all-completions\\)" property)
209 (tramp-flush-file-property key file property)))
210 (tramp-get-hash-table key)))))
211
196;;;###tramp-autoload 212;;;###tramp-autoload
197(defun tramp-flush-file-properties (key file) 213(defun tramp-flush-file-properties (key file)
198 "Remove all properties of FILE in the cache context of KEY." 214 "Remove all properties of FILE in the cache context of KEY."
@@ -209,7 +225,9 @@ Returns VALUE."
209 ;; Remove file properties of symlinks. 225 ;; Remove file properties of symlinks.
210 (when (and (stringp truename) 226 (when (and (stringp truename)
211 (not (string-equal file (directory-file-name truename)))) 227 (not (string-equal file (directory-file-name truename))))
212 (tramp-flush-file-properties key truename)))) 228 (tramp-flush-file-properties key truename))
229 ;; Remove selected properties of upper directory.
230 (tramp-flush-file-upper-properties key file)))
213 231
214;;;###tramp-autoload 232;;;###tramp-autoload
215(defun tramp-flush-directory-properties (key directory) 233(defun tramp-flush-directory-properties (key directory)
@@ -231,7 +249,9 @@ Remove also properties of all files in subdirectories."
231 ;; Remove file properties of symlinks. 249 ;; Remove file properties of symlinks.
232 (when (and (stringp truename) 250 (when (and (stringp truename)
233 (not (string-equal directory (directory-file-name truename)))) 251 (not (string-equal directory (directory-file-name truename))))
234 (tramp-flush-directory-properties key truename)))) 252 (tramp-flush-directory-properties key truename))
253 ;; Remove selected properties of upper directory.
254 (tramp-flush-file-upper-properties key directory)))
235 255
236;; Reverting or killing a buffer should also flush file properties. 256;; Reverting or killing a buffer should also flush file properties.
237;; They could have been changed outside Tramp. In eshell, "ls" would 257;; They could have been changed outside Tramp. In eshell, "ls" would
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index a606ba67177..8cec5871cfc 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -817,12 +817,10 @@ file names."
817 817
818 (when (and t1 (eq op 'rename)) 818 (when (and t1 (eq op 'rename))
819 (with-parsed-tramp-file-name filename nil 819 (with-parsed-tramp-file-name filename nil
820 (tramp-flush-file-properties v (file-name-directory localname))
821 (tramp-flush-file-properties v localname))) 820 (tramp-flush-file-properties v localname)))
822 821
823 (when t2 822 (when t2
824 (with-parsed-tramp-file-name newname nil 823 (with-parsed-tramp-file-name newname nil
825 (tramp-flush-file-properties v (file-name-directory localname))
826 (tramp-flush-file-properties v localname)))))))) 824 (tramp-flush-file-properties v localname))))))))
827 825
828(defun tramp-gvfs-handle-copy-file 826(defun tramp-gvfs-handle-copy-file
@@ -857,7 +855,6 @@ file names."
857 (tramp-error 855 (tramp-error
858 v 'file-error "Couldn't delete non-empty %s" directory))) 856 v 'file-error "Couldn't delete non-empty %s" directory)))
859 857
860 (tramp-flush-file-properties v (file-name-directory localname))
861 (tramp-flush-directory-properties v localname) 858 (tramp-flush-directory-properties v localname)
862 (unless 859 (unless
863 (tramp-gvfs-send-command 860 (tramp-gvfs-send-command
@@ -872,7 +869,6 @@ file names."
872(defun tramp-gvfs-handle-delete-file (filename &optional trash) 869(defun tramp-gvfs-handle-delete-file (filename &optional trash)
873 "Like `delete-file' for Tramp files." 870 "Like `delete-file' for Tramp files."
874 (with-parsed-tramp-file-name filename nil 871 (with-parsed-tramp-file-name filename nil
875 (tramp-flush-file-properties v (file-name-directory localname))
876 (tramp-flush-file-properties v localname) 872 (tramp-flush-file-properties v localname)
877 (unless 873 (unless
878 (tramp-gvfs-send-command 874 (tramp-gvfs-send-command
@@ -1296,7 +1292,6 @@ file-notify events."
1296 "Like `make-directory' for Tramp files." 1292 "Like `make-directory' for Tramp files."
1297 (setq dir (directory-file-name (expand-file-name dir))) 1293 (setq dir (directory-file-name (expand-file-name dir)))
1298 (with-parsed-tramp-file-name dir nil 1294 (with-parsed-tramp-file-name dir nil
1299 (tramp-flush-file-properties v (file-name-directory localname))
1300 (tramp-flush-directory-properties v localname) 1295 (tramp-flush-directory-properties v localname)
1301 (save-match-data 1296 (save-match-data
1302 (let ((ldir (file-name-directory dir))) 1297 (let ((ldir (file-name-directory dir)))
@@ -1329,7 +1324,6 @@ file-notify events."
1329(defun tramp-gvfs-handle-set-file-modes (filename mode) 1324(defun tramp-gvfs-handle-set-file-modes (filename mode)
1330 "Like `set-file-modes' for Tramp files." 1325 "Like `set-file-modes' for Tramp files."
1331 (with-parsed-tramp-file-name filename nil 1326 (with-parsed-tramp-file-name filename nil
1332 (tramp-flush-file-properties v (file-name-directory localname))
1333 (tramp-flush-file-properties v localname) 1327 (tramp-flush-file-properties v localname)
1334 (tramp-gvfs-send-command 1328 (tramp-gvfs-send-command
1335 v "gvfs-set-attribute" "-t" "uint32" 1329 v "gvfs-set-attribute" "-t" "uint32"
@@ -1339,7 +1333,6 @@ file-notify events."
1339(defun tramp-gvfs-handle-set-file-times (filename &optional time) 1333(defun tramp-gvfs-handle-set-file-times (filename &optional time)
1340 "Like `set-file-times' for Tramp files." 1334 "Like `set-file-times' for Tramp files."
1341 (with-parsed-tramp-file-name filename nil 1335 (with-parsed-tramp-file-name filename nil
1342 (tramp-flush-file-properties v (file-name-directory localname))
1343 (tramp-flush-file-properties v localname) 1336 (tramp-flush-file-properties v localname)
1344 (let ((time 1337 (let ((time
1345 (if (or (null time) 1338 (if (or (null time)
@@ -1355,7 +1348,6 @@ file-notify events."
1355(defun tramp-gvfs-set-file-uid-gid (filename &optional uid gid) 1348(defun tramp-gvfs-set-file-uid-gid (filename &optional uid gid)
1356 "Like `tramp-set-file-uid-gid' for Tramp files." 1349 "Like `tramp-set-file-uid-gid' for Tramp files."
1357 (with-parsed-tramp-file-name filename nil 1350 (with-parsed-tramp-file-name filename nil
1358 (tramp-flush-file-properties v (file-name-directory localname))
1359 (tramp-flush-file-properties v localname) 1351 (tramp-flush-file-properties v localname)
1360 (when (natnump uid) 1352 (when (natnump uid)
1361 (tramp-gvfs-send-command 1353 (tramp-gvfs-send-command
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
index 9b3eab34771..e0fd8e34415 100644
--- a/lisp/net/tramp-rclone.el
+++ b/lisp/net/tramp-rclone.el
@@ -244,30 +244,22 @@ file names."
244 244
245 (when (and t1 (eq op 'rename)) 245 (when (and t1 (eq op 'rename))
246 (with-parsed-tramp-file-name filename v1 246 (with-parsed-tramp-file-name filename v1
247 (tramp-flush-file-properties
248 v1 (file-name-directory v1-localname))
249 (tramp-flush-file-properties v1 v1-localname) 247 (tramp-flush-file-properties v1 v1-localname)
250 (when (tramp-rclone-file-name-p filename) 248 (when (tramp-rclone-file-name-p filename)
251 (tramp-rclone-flush-directory-cache v1) 249 (tramp-rclone-flush-directory-cache v1)
252 ;; The mount point's directory cache might need time 250 ;; The mount point's directory cache might need time
253 ;; to flush. 251 ;; to flush.
254 (while (file-exists-p filename) 252 (while (file-exists-p filename)
255 (tramp-flush-file-properties
256 v1 (file-name-directory v1-localname))
257 (tramp-flush-file-properties v1 v1-localname))))) 253 (tramp-flush-file-properties v1 v1-localname)))))
258 254
259 (when t2 255 (when t2
260 (with-parsed-tramp-file-name newname v2 256 (with-parsed-tramp-file-name newname v2
261 (tramp-flush-file-properties
262 v2 (file-name-directory v2-localname))
263 (tramp-flush-file-properties v2 v2-localname) 257 (tramp-flush-file-properties v2 v2-localname)
264 (when (tramp-rclone-file-name-p newname) 258 (when (tramp-rclone-file-name-p newname)
265 (tramp-rclone-flush-directory-cache v2) 259 (tramp-rclone-flush-directory-cache v2)
266 ;; The mount point's directory cache might need time 260 ;; The mount point's directory cache might need time
267 ;; to flush. 261 ;; to flush.
268 (while (not (file-exists-p newname)) 262 (while (not (file-exists-p newname))
269 (tramp-flush-file-properties
270 v2 (file-name-directory v2-localname))
271 (tramp-flush-file-properties v2 v2-localname)))))))))) 263 (tramp-flush-file-properties v2 v2-localname))))))))))
272 264
273(defun tramp-rclone-handle-copy-file 265(defun tramp-rclone-handle-copy-file
@@ -292,7 +284,6 @@ file names."
292 "Like `delete-directory' for Tramp files." 284 "Like `delete-directory' for Tramp files."
293 (with-parsed-tramp-file-name (expand-file-name directory) nil 285 (with-parsed-tramp-file-name (expand-file-name directory) nil
294 (delete-directory (tramp-rclone-local-file-name directory) recursive trash) 286 (delete-directory (tramp-rclone-local-file-name directory) recursive trash)
295 (tramp-flush-file-properties v (file-name-directory localname))
296 (tramp-flush-directory-properties v localname) 287 (tramp-flush-directory-properties v localname)
297 (tramp-rclone-flush-directory-cache v))) 288 (tramp-rclone-flush-directory-cache v)))
298 289
@@ -300,7 +291,6 @@ file names."
300 "Like `delete-file' for Tramp files." 291 "Like `delete-file' for Tramp files."
301 (with-parsed-tramp-file-name (expand-file-name filename) nil 292 (with-parsed-tramp-file-name (expand-file-name filename) nil
302 (delete-file (tramp-rclone-local-file-name filename) trash) 293 (delete-file (tramp-rclone-local-file-name filename) trash)
303 (tramp-flush-file-properties v (file-name-directory localname))
304 (tramp-flush-file-properties v localname) 294 (tramp-flush-file-properties v localname)
305 (tramp-rclone-flush-directory-cache v))) 295 (tramp-rclone-flush-directory-cache v)))
306 296
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 3399b961b2a..54bf2ba773e 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1069,7 +1069,6 @@ component is used as the target of the symlink."
1069 (tramp-error v 'file-already-exists localname) 1069 (tramp-error v 'file-already-exists localname)
1070 (delete-file linkname))) 1070 (delete-file linkname)))
1071 1071
1072 (tramp-flush-file-properties v (file-name-directory localname))
1073 (tramp-flush-file-properties v localname) 1072 (tramp-flush-file-properties v localname)
1074 1073
1075 ;; Right, they are on the same host, regardless of user, 1074 ;; Right, they are on the same host, regardless of user,
@@ -1450,7 +1449,6 @@ of."
1450(defun tramp-sh-handle-set-file-modes (filename mode) 1449(defun tramp-sh-handle-set-file-modes (filename mode)
1451 "Like `set-file-modes' for Tramp files." 1450 "Like `set-file-modes' for Tramp files."
1452 (with-parsed-tramp-file-name filename nil 1451 (with-parsed-tramp-file-name filename nil
1453 (tramp-flush-file-properties v (file-name-directory localname))
1454 (tramp-flush-file-properties v localname) 1452 (tramp-flush-file-properties v localname)
1455 ;; FIXME: extract the proper text from chmod's stderr. 1453 ;; FIXME: extract the proper text from chmod's stderr.
1456 (tramp-barf-unless-okay 1454 (tramp-barf-unless-okay
@@ -1462,7 +1460,6 @@ of."
1462 "Like `set-file-times' for Tramp files." 1460 "Like `set-file-times' for Tramp files."
1463 (with-parsed-tramp-file-name filename nil 1461 (with-parsed-tramp-file-name filename nil
1464 (when (tramp-get-remote-touch v) 1462 (when (tramp-get-remote-touch v)
1465 (tramp-flush-file-properties v (file-name-directory localname))
1466 (tramp-flush-file-properties v localname) 1463 (tramp-flush-file-properties v localname)
1467 (let ((time 1464 (let ((time
1468 (if (or (null time) 1465 (if (or (null time)
@@ -1875,7 +1872,6 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
1875 v2-localname))))) 1872 v2-localname)))))
1876 (tramp-error v2 'file-already-exists newname) 1873 (tramp-error v2 'file-already-exists newname)
1877 (delete-file newname))) 1874 (delete-file newname)))
1878 (tramp-flush-file-properties v2 (file-name-directory v2-localname))
1879 (tramp-flush-file-properties v2 v2-localname) 1875 (tramp-flush-file-properties v2 v2-localname)
1880 (tramp-barf-unless-okay 1876 (tramp-barf-unless-okay
1881 v1 1877 v1
@@ -1942,7 +1938,6 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
1942 ;; When newname did exist, we have wrong cached values. 1938 ;; When newname did exist, we have wrong cached values.
1943 (when t2 1939 (when t2
1944 (with-parsed-tramp-file-name newname nil 1940 (with-parsed-tramp-file-name newname nil
1945 (tramp-flush-file-properties v (file-name-directory localname))
1946 (tramp-flush-file-properties v localname)))))) 1941 (tramp-flush-file-properties v localname))))))
1947 1942
1948(defun tramp-sh-handle-rename-file 1943(defun tramp-sh-handle-rename-file
@@ -2072,15 +2067,11 @@ file names."
2072 ;; In case of `rename', we must flush the cache of the source file. 2067 ;; In case of `rename', we must flush the cache of the source file.
2073 (when (and t1 (eq op 'rename)) 2068 (when (and t1 (eq op 'rename))
2074 (with-parsed-tramp-file-name filename v1 2069 (with-parsed-tramp-file-name filename v1
2075 (tramp-flush-file-properties
2076 v1 (file-name-directory v1-localname))
2077 (tramp-flush-file-properties v1 v1-localname))) 2070 (tramp-flush-file-properties v1 v1-localname)))
2078 2071
2079 ;; When newname did exist, we have wrong cached values. 2072 ;; When newname did exist, we have wrong cached values.
2080 (when t2 2073 (when t2
2081 (with-parsed-tramp-file-name newname v2 2074 (with-parsed-tramp-file-name newname v2
2082 (tramp-flush-file-properties
2083 v2 (file-name-directory v2-localname))
2084 (tramp-flush-file-properties v2 v2-localname)))))))) 2075 (tramp-flush-file-properties v2 v2-localname))))))))
2085 2076
2086(defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date) 2077(defun tramp-do-copy-or-rename-file-via-buffer (op filename newname keep-date)
@@ -2505,7 +2496,6 @@ The method used must be an out-of-band method."
2505 "Like `delete-directory' for Tramp files." 2496 "Like `delete-directory' for Tramp files."
2506 (setq directory (expand-file-name directory)) 2497 (setq directory (expand-file-name directory))
2507 (with-parsed-tramp-file-name directory nil 2498 (with-parsed-tramp-file-name directory nil
2508 (tramp-flush-file-properties v (file-name-directory localname))
2509 (tramp-flush-directory-properties v localname) 2499 (tramp-flush-directory-properties v localname)
2510 (tramp-barf-unless-okay 2500 (tramp-barf-unless-okay
2511 v (format "cd / && %s %s" 2501 v (format "cd / && %s %s"
@@ -2518,7 +2508,6 @@ The method used must be an out-of-band method."
2518 "Like `delete-file' for Tramp files." 2508 "Like `delete-file' for Tramp files."
2519 (setq filename (expand-file-name filename)) 2509 (setq filename (expand-file-name filename))
2520 (with-parsed-tramp-file-name filename nil 2510 (with-parsed-tramp-file-name filename nil
2521 (tramp-flush-file-properties v (file-name-directory localname))
2522 (tramp-flush-file-properties v localname) 2511 (tramp-flush-file-properties v localname)
2523 (tramp-barf-unless-okay 2512 (tramp-barf-unless-okay
2524 v (format "%s %s" 2513 v (format "%s %s"
@@ -3394,7 +3383,6 @@ the result will be a local, non-Tramp, file name."
3394 (when coding-system-used 3383 (when coding-system-used
3395 (set 'last-coding-system-used coding-system-used)))) 3384 (set 'last-coding-system-used coding-system-used))))
3396 3385
3397 (tramp-flush-file-properties v (file-name-directory localname))
3398 (tramp-flush-file-properties v localname) 3386 (tramp-flush-file-properties v localname)
3399 3387
3400 ;; We must protect `last-coding-system-used', now we have set it 3388 ;; We must protect `last-coding-system-used', now we have set it
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index cb8d2df0847..594463d77fd 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -371,7 +371,6 @@ pass to the OPERATION."
371 (delete-file newname))) 371 (delete-file newname)))
372 ;; We must also flush the cache of the directory, because 372 ;; We must also flush the cache of the directory, because
373 ;; `file-attributes' reads the values from there. 373 ;; `file-attributes' reads the values from there.
374 (tramp-flush-file-properties v2 (file-name-directory v2-localname))
375 (tramp-flush-file-properties v2 v2-localname) 374 (tramp-flush-file-properties v2 v2-localname)
376 (unless 375 (unless
377 (tramp-smb-send-command 376 (tramp-smb-send-command
@@ -548,7 +547,6 @@ pass to the OPERATION."
548 ;; When newname did exist, we have wrong cached values. 547 ;; When newname did exist, we have wrong cached values.
549 (when t2 548 (when t2
550 (with-parsed-tramp-file-name newname nil 549 (with-parsed-tramp-file-name newname nil
551 (tramp-flush-file-properties v (file-name-directory localname))
552 (tramp-flush-file-properties v localname)))) 550 (tramp-flush-file-properties v localname))))
553 551
554 ;; We must do it file-wise. 552 ;; We must do it file-wise.
@@ -596,7 +594,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
596 594
597 ;; We must also flush the cache of the directory, because 595 ;; We must also flush the cache of the directory, because
598 ;; `file-attributes' reads the values from there. 596 ;; `file-attributes' reads the values from there.
599 (tramp-flush-file-properties v (file-name-directory localname))
600 (tramp-flush-file-properties v localname) 597 (tramp-flush-file-properties v localname)
601 (unless (tramp-smb-get-share v) 598 (unless (tramp-smb-get-share v)
602 (tramp-error 599 (tramp-error
@@ -631,7 +628,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
631 (with-parsed-tramp-file-name directory nil 628 (with-parsed-tramp-file-name directory nil
632 ;; We must also flush the cache of the directory, because 629 ;; We must also flush the cache of the directory, because
633 ;; `file-attributes' reads the values from there. 630 ;; `file-attributes' reads the values from there.
634 (tramp-flush-file-properties v (file-name-directory localname))
635 (tramp-flush-directory-properties v localname) 631 (tramp-flush-directory-properties v localname)
636 (unless (tramp-smb-send-command 632 (unless (tramp-smb-send-command
637 v (format 633 v (format
@@ -657,7 +653,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
657 (with-parsed-tramp-file-name filename nil 653 (with-parsed-tramp-file-name filename nil
658 ;; We must also flush the cache of the directory, because 654 ;; We must also flush the cache of the directory, because
659 ;; `file-attributes' reads the values from there. 655 ;; `file-attributes' reads the values from there.
660 (tramp-flush-file-properties v (file-name-directory localname))
661 (tramp-flush-file-properties v localname) 656 (tramp-flush-file-properties v localname)
662 (unless (tramp-smb-send-command 657 (unless (tramp-smb-send-command
663 v (format 658 v (format
@@ -1154,7 +1149,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
1154 (format "mkdir \"%s\"" file))) 1149 (format "mkdir \"%s\"" file)))
1155 ;; We must also flush the cache of the directory, because 1150 ;; We must also flush the cache of the directory, because
1156 ;; `file-attributes' reads the values from there. 1151 ;; `file-attributes' reads the values from there.
1157 (tramp-flush-file-properties v (file-name-directory localname))
1158 (tramp-flush-file-properties v localname)) 1152 (tramp-flush-file-properties v localname))
1159 (unless (file-directory-p directory) 1153 (unless (file-directory-p directory)
1160 (tramp-error v 'file-error "Couldn't make directory %s" directory))))) 1154 (tramp-error v 'file-error "Couldn't make directory %s" directory)))))
@@ -1202,7 +1196,6 @@ component is used as the target of the symlink."
1202 1196
1203 ;; We must also flush the cache of the directory, because 1197 ;; We must also flush the cache of the directory, because
1204 ;; `file-attributes' reads the values from there. 1198 ;; `file-attributes' reads the values from there.
1205 (tramp-flush-file-properties v (file-name-directory localname))
1206 (tramp-flush-file-properties v localname) 1199 (tramp-flush-file-properties v localname)
1207 1200
1208 (unless 1201 (unless
@@ -1358,11 +1351,7 @@ component is used as the target of the symlink."
1358 1351
1359 ;; We must also flush the cache of the directory, because 1352 ;; We must also flush the cache of the directory, because
1360 ;; `file-attributes' reads the values from there. 1353 ;; `file-attributes' reads the values from there.
1361 (tramp-flush-file-properties
1362 v1 (file-name-directory v1-localname))
1363 (tramp-flush-file-properties v1 v1-localname) 1354 (tramp-flush-file-properties v1 v1-localname)
1364 (tramp-flush-file-properties
1365 v2 (file-name-directory v2-localname))
1366 (tramp-flush-file-properties v2 v2-localname) 1355 (tramp-flush-file-properties v2 v2-localname)
1367 (unless (tramp-smb-get-share v2) 1356 (unless (tramp-smb-get-share v2)
1368 (tramp-error 1357 (tramp-error
@@ -1548,7 +1537,6 @@ errors for shares like \"C$/\", which are common in Microsoft Windows."
1548 1537
1549 ;; We must also flush the cache of the directory, because 1538 ;; We must also flush the cache of the directory, because
1550 ;; `file-attributes' reads the values from there. 1539 ;; `file-attributes' reads the values from there.
1551 (tramp-flush-file-properties v (file-name-directory localname))
1552 (tramp-flush-file-properties v localname) 1540 (tramp-flush-file-properties v localname)
1553 (let ((curbuf (current-buffer)) 1541 (let ((curbuf (current-buffer))
1554 (tmpfile (tramp-compat-make-temp-file filename))) 1542 (tmpfile (tramp-compat-make-temp-file filename)))
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index 0ded85fb554..0ec98bb0691 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -189,7 +189,6 @@ pass to the OPERATION."
189 v2-localname))))) 189 v2-localname)))))
190 (tramp-error v2 'file-already-exists newname) 190 (tramp-error v2 'file-already-exists newname)
191 (delete-file newname))) 191 (delete-file newname)))
192 (tramp-flush-file-properties v2 (file-name-directory v2-localname))
193 (tramp-flush-file-properties v2 v2-localname) 192 (tramp-flush-file-properties v2 v2-localname)
194 (unless 193 (unless
195 (tramp-sudoedit-send-command 194 (tramp-sudoedit-send-command
@@ -291,14 +290,10 @@ absolute file names."
291 290
292 (when (and t1 (eq op 'rename)) 291 (when (and t1 (eq op 'rename))
293 (with-parsed-tramp-file-name filename v1 292 (with-parsed-tramp-file-name filename v1
294 (tramp-flush-file-properties
295 v1 (file-name-directory v1-localname))
296 (tramp-flush-file-properties v1 v1-localname))) 293 (tramp-flush-file-properties v1 v1-localname)))
297 294
298 (when t2 295 (when t2
299 (with-parsed-tramp-file-name newname v2 296 (with-parsed-tramp-file-name newname v2
300 (tramp-flush-file-properties
301 v2 (file-name-directory v2-localname))
302 (tramp-flush-file-properties v2 v2-localname))))))) 297 (tramp-flush-file-properties v2 v2-localname)))))))
303 298
304(defun tramp-sudoedit-handle-copy-file 299(defun tramp-sudoedit-handle-copy-file
@@ -323,7 +318,6 @@ absolute file names."
323 "Like `delete-directory' for Tramp files." 318 "Like `delete-directory' for Tramp files."
324 (setq directory (expand-file-name directory)) 319 (setq directory (expand-file-name directory))
325 (with-parsed-tramp-file-name directory nil 320 (with-parsed-tramp-file-name directory nil
326 (tramp-flush-file-properties v (file-name-directory localname))
327 (tramp-flush-directory-properties v localname) 321 (tramp-flush-directory-properties v localname)
328 (unless 322 (unless
329 (tramp-sudoedit-send-command 323 (tramp-sudoedit-send-command
@@ -335,7 +329,6 @@ absolute file names."
335(defun tramp-sudoedit-handle-delete-file (filename &optional trash) 329(defun tramp-sudoedit-handle-delete-file (filename &optional trash)
336 "Like `delete-file' for Tramp files." 330 "Like `delete-file' for Tramp files."
337 (with-parsed-tramp-file-name filename nil 331 (with-parsed-tramp-file-name filename nil
338 (tramp-flush-file-properties v (file-name-directory localname))
339 (tramp-flush-file-properties v localname) 332 (tramp-flush-file-properties v localname)
340 (unless 333 (unless
341 (tramp-sudoedit-send-command 334 (tramp-sudoedit-send-command
@@ -467,7 +460,6 @@ the result will be a local, non-Tramp, file name."
467(defun tramp-sudoedit-handle-set-file-modes (filename mode) 460(defun tramp-sudoedit-handle-set-file-modes (filename mode)
468 "Like `set-file-modes' for Tramp files." 461 "Like `set-file-modes' for Tramp files."
469 (with-parsed-tramp-file-name filename nil 462 (with-parsed-tramp-file-name filename nil
470 (tramp-flush-file-properties v (file-name-directory localname))
471 (tramp-flush-file-properties v localname) 463 (tramp-flush-file-properties v localname)
472 (unless (tramp-sudoedit-send-command 464 (unless (tramp-sudoedit-send-command
473 v "chmod" (format "%o" mode) 465 v "chmod" (format "%o" mode)
@@ -526,7 +518,6 @@ the result will be a local, non-Tramp, file name."
526(defun tramp-sudoedit-handle-set-file-times (filename &optional time) 518(defun tramp-sudoedit-handle-set-file-times (filename &optional time)
527 "Like `set-file-times' for Tramp files." 519 "Like `set-file-times' for Tramp files."
528 (with-parsed-tramp-file-name filename nil 520 (with-parsed-tramp-file-name filename nil
529 (tramp-flush-file-properties v (file-name-directory localname))
530 (tramp-flush-file-properties v localname) 521 (tramp-flush-file-properties v localname)
531 (let ((time 522 (let ((time
532 (if (or (null time) 523 (if (or (null time)
@@ -634,7 +625,6 @@ component is used as the target of the symlink."
634 (tramp-error v 'file-already-exists localname) 625 (tramp-error v 'file-already-exists localname)
635 (delete-file linkname))) 626 (delete-file linkname)))
636 627
637 (tramp-flush-file-properties v (file-name-directory localname))
638 (tramp-flush-file-properties v localname) 628 (tramp-flush-file-properties v localname)
639 (tramp-sudoedit-send-command 629 (tramp-sudoedit-send-command
640 v "ln" "-sf" 630 v "ln" "-sf"
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c589557132a..77d727e2f2f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3006,7 +3006,6 @@ User is always nil."
3006 localname))))) 3006 localname)))))
3007 (tramp-error v 'file-already-exists newname) 3007 (tramp-error v 'file-already-exists newname)
3008 (delete-file newname))) 3008 (delete-file newname)))
3009 (tramp-flush-file-properties v (file-name-directory localname))
3010 (tramp-flush-file-properties v localname) 3009 (tramp-flush-file-properties v localname)
3011 (copy-file 3010 (copy-file
3012 filename newname 'ok-if-already-exists 'keep-time 3011 filename newname 'ok-if-already-exists 'keep-time
@@ -3794,7 +3793,6 @@ of."
3794 (tramp-error 3793 (tramp-error
3795 v 'file-error "Couldn't write region to `%s'" filename)))) 3794 v 'file-error "Couldn't write region to `%s'" filename))))
3796 3795
3797 (tramp-flush-file-properties v (file-name-directory localname))
3798 (tramp-flush-file-properties v localname) 3796 (tramp-flush-file-properties v localname)
3799 3797
3800 ;; Set file modification time. 3798 ;; Set file modification time.