]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix stale cache in Tramp
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 5 Feb 2024 11:54:03 +0000 (12:54 +0100)
committerEshel Yaron <me@eshelyaron.com>
Wed, 7 Feb 2024 10:52:02 +0000 (11:52 +0100)
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
Flush file properties in time.  (Bug#68805)

(cherry picked from commit c7539a363b8b109d24457aaeb60fb51bd0a03e4f)

lisp/net/tramp-sh.el

index 33ab1c42db15b0235dc6502f970059026f6e1638..402a7cd6c2222cda7a9be8e1d6a616e980571507 100644 (file)
@@ -2018,7 +2018,7 @@ ID-FORMAT valid values are `string' and `integer'."
             #'copy-directory
             (list dirname newname keep-date parents copy-contents))))
 
-       ;; When newname did exist, we have wrong cached values.
+       ;; NEWNAME has wrong cached values.
        (when t2
          (with-parsed-tramp-file-name (expand-file-name newname) nil
            (tramp-flush-file-properties v localname)))))))
@@ -2157,24 +2157,24 @@ file names."
              ;; One of them must be a Tramp file.
              (error "Tramp implementation says this cannot happen")))
 
-           ;; Handle `preserve-extended-attributes'.  We ignore
-           ;; possible errors, because ACL strings could be
-           ;; incompatible.
-           (when-let ((attributes (and preserve-extended-attributes
-                                       (file-extended-attributes filename))))
-             (ignore-errors
-               (set-file-extended-attributes newname attributes)))
-
            ;; In case of `rename', we must flush the cache of the source file.
            (when (and t1 (eq op 'rename))
              (with-parsed-tramp-file-name filename v1
                (tramp-flush-file-properties v1 v1-localname)))
 
-           ;; When newname did exist, we have wrong cached values.
+           ;; NEWNAME has wrong cached values.
            (when t2
              (with-parsed-tramp-file-name newname v2
                (tramp-flush-file-properties v2 v2-localname)))
 
+           ;; Handle `preserve-extended-attributes'.  We ignore
+           ;; possible errors, because ACL strings could be
+           ;; incompatible.
+           (when-let ((attributes (and preserve-extended-attributes
+                                       (file-extended-attributes filename))))
+             (ignore-errors
+               (set-file-extended-attributes newname attributes)))
+
             ;; KEEP-DATE handling.
             (when (and keep-date (not copy-keep-date))
               (tramp-compat-set-file-times
@@ -2446,7 +2446,7 @@ The method used must be an out-of-band method."
            copy-program (tramp-get-method-parameter v 'tramp-copy-program)
            copy-args
            ;; " " has either been a replacement of "%k" (when
-           ;; keep-date argument is non-nil), or a replacement for
+           ;; KEEP-DATE argument is non-nil), or a replacement for
            ;; the whole keep-date sublist.
            (delete " " (apply #'tramp-expand-args v 'tramp-copy-args spec))
            ;; `tramp-ssh-controlmaster-options' is a string instead
@@ -5362,7 +5362,7 @@ connection if a previous connection has died for some reason."
                              "2>" (tramp-get-remote-null-device previous-hop))
                          ?l (concat remote-shell " " extra-args " -i"))
                         ;; A restricted shell does not allow "exec".
-                        (when r-shell '("&&" "exit")) '("||" "exit"))
+                        (when r-shell '("&&" "exit")) '("||" "exit"))
                        " "))
 
                      ;; Send the command.