diff options
| author | Michael Albinus | 2010-02-16 17:03:29 +0100 |
|---|---|---|
| committer | Michael Albinus | 2010-02-16 17:03:29 +0100 |
| commit | aac0b0f2be0f68669368b6050e4d0df26a9a8d9c (patch) | |
| tree | 7c507c8dcca8c61d99a108c59a71b4548ebbb791 | |
| parent | adad7a44dd1c08e2e68cb7daf095cdde35a3606d (diff) | |
| download | emacs-aac0b0f2be0f68669368b6050e4d0df26a9a8d9c.tar.gz emacs-aac0b0f2be0f68669368b6050e4d0df26a9a8d9c.zip | |
* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix
errors in copying directories.
(tramp-handle-add-name-to-file, tramp-handle-copy-directory)
(tramp-do-copy-or-rename-file, tramp-handle-delete-directory)
(tramp-handle-delete-file)
(tramp-handle-dired-recursive-delete-directory)
(tramp-handle-write-region): Flush also the cache for the upper
directory.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 44 |
2 files changed, 44 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 64dff020286..17655fe4f6b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2010-02-16 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix | ||
| 4 | errors in copying directories. | ||
| 5 | (tramp-handle-add-name-to-file, tramp-handle-copy-directory) | ||
| 6 | (tramp-do-copy-or-rename-file, tramp-handle-delete-directory) | ||
| 7 | (tramp-handle-delete-file) | ||
| 8 | (tramp-handle-dired-recursive-delete-directory) | ||
| 9 | (tramp-handle-write-region): Flush also the cache for the upper | ||
| 10 | directory. | ||
| 11 | |||
| 1 | 2010-02-16 Chong Yidong <cyd@stupidchicken.com> | 12 | 2010-02-16 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 13 | ||
| 3 | * simple.el (save-interprogram-paste-before-kill): Doc fix. | 14 | * simple.el (save-interprogram-paste-before-kill): Doc fix. |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e59383e31e7..77a3875eeb4 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3420,6 +3420,7 @@ tramp-handle-file-name-all-completions: internal error accessing `%s': `%s'" | |||
| 3420 | (tramp-error | 3420 | (tramp-error |
| 3421 | v2 'file-error | 3421 | v2 'file-error |
| 3422 | "add-name-to-file: file %s already exists" newname)) | 3422 | "add-name-to-file: file %s already exists" newname)) |
| 3423 | (tramp-flush-file-property v2 (file-name-directory v2-localname)) | ||
| 3423 | (tramp-flush-file-property v2 v2-localname) | 3424 | (tramp-flush-file-property v2 v2-localname) |
| 3424 | (tramp-barf-unless-okay | 3425 | (tramp-barf-unless-okay |
| 3425 | v1 | 3426 | v1 |
| @@ -3478,7 +3479,13 @@ tramp-handle-file-name-all-completions: internal error accessing `%s': `%s'" | |||
| 3478 | 'copy dirname newname keep-date)) | 3479 | 'copy dirname newname keep-date)) |
| 3479 | ;; We must do it file-wise. | 3480 | ;; We must do it file-wise. |
| 3480 | (tramp-run-real-handler | 3481 | (tramp-run-real-handler |
| 3481 | 'copy-directory (list dirname newname keep-date parents)))))) | 3482 | 'copy-directory (list dirname newname keep-date parents))) |
| 3483 | |||
| 3484 | ;; When newname did exist, we have wrong cached values. | ||
| 3485 | (when t2 | ||
| 3486 | (with-parsed-tramp-file-name newname nil | ||
| 3487 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 3488 | (tramp-flush-file-property v localname)))))) | ||
| 3482 | 3489 | ||
| 3483 | (defun tramp-handle-rename-file | 3490 | (defun tramp-handle-rename-file |
| 3484 | (filename newname &optional ok-if-already-exists) | 3491 | (filename newname &optional ok-if-already-exists) |
| @@ -3583,11 +3590,13 @@ and `rename'. FILENAME and NEWNAME must be absolute file names." | |||
| 3583 | ;; In case of `rename', we must flush the cache of the source file. | 3590 | ;; In case of `rename', we must flush the cache of the source file. |
| 3584 | (when (and t1 (eq op 'rename)) | 3591 | (when (and t1 (eq op 'rename)) |
| 3585 | (with-parsed-tramp-file-name filename nil | 3592 | (with-parsed-tramp-file-name filename nil |
| 3593 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 3586 | (tramp-flush-file-property v localname))) | 3594 | (tramp-flush-file-property v localname))) |
| 3587 | 3595 | ||
| 3588 | ;; When newname did exist, we have wrong cached values. | 3596 | ;; When newname did exist, we have wrong cached values. |
| 3589 | (when t2 | 3597 | (when t2 |
| 3590 | (with-parsed-tramp-file-name newname nil | 3598 | (with-parsed-tramp-file-name newname nil |
| 3599 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 3591 | (tramp-flush-file-property v localname))) | 3600 | (tramp-flush-file-property v localname))) |
| 3592 | 3601 | ||
| 3593 | (with-parsed-tramp-file-name (if t1 filename newname) nil | 3602 | (with-parsed-tramp-file-name (if t1 filename newname) nil |
| @@ -3789,7 +3798,13 @@ The method used must be an out-of-band method." | |||
| 3789 | 3798 | ||
| 3790 | ;; Both are Tramp files. We shall optimize it, when the | 3799 | ;; Both are Tramp files. We shall optimize it, when the |
| 3791 | ;; methods for filename and newname are the same. | 3800 | ;; methods for filename and newname are the same. |
| 3792 | (let ((tmpfile (tramp-compat-make-temp-file localname))) | 3801 | (let ((tmpfile |
| 3802 | (if (file-regular-p filename) | ||
| 3803 | (tramp-compat-make-temp-file localname) | ||
| 3804 | (make-temp-name | ||
| 3805 | (expand-file-name | ||
| 3806 | tramp-temp-name-prefix | ||
| 3807 | (tramp-compat-temporary-file-directory)))))) | ||
| 3793 | (unwind-protect | 3808 | (unwind-protect |
| 3794 | (progn | 3809 | (progn |
| 3795 | (tramp-do-copy-or-rename-file-out-of-band | 3810 | (tramp-do-copy-or-rename-file-out-of-band |
| @@ -3798,7 +3813,9 @@ The method used must be an out-of-band method." | |||
| 3798 | 'rename tmpfile newname keep-date)) | 3813 | 'rename tmpfile newname keep-date)) |
| 3799 | ;; Save exit. | 3814 | ;; Save exit. |
| 3800 | (condition-case nil | 3815 | (condition-case nil |
| 3801 | (delete-file tmpfile) | 3816 | (if (file-regular-p tmpfile) |
| 3817 | (delete-file tmpfile) | ||
| 3818 | (delete-directory tmpfile 'recursive)) | ||
| 3802 | (error)))) | 3819 | (error)))) |
| 3803 | 3820 | ||
| 3804 | ;; Expand hops. Might be necessary for gateway methods. | 3821 | ;; Expand hops. Might be necessary for gateway methods. |
| @@ -3913,7 +3930,9 @@ The method used must be an out-of-band method." | |||
| 3913 | 3930 | ||
| 3914 | ;; If the operation was `rename', delete the original file. | 3931 | ;; If the operation was `rename', delete the original file. |
| 3915 | (unless (eq op 'copy) | 3932 | (unless (eq op 'copy) |
| 3916 | (delete-file filename))))) | 3933 | (if (file-regular-p filename) |
| 3934 | (delete-file filename) | ||
| 3935 | (delete-directory filename 'recursive)))))) | ||
| 3917 | 3936 | ||
| 3918 | (defun tramp-handle-make-directory (dir &optional parents) | 3937 | (defun tramp-handle-make-directory (dir &optional parents) |
| 3919 | "Like `make-directory' for Tramp files." | 3938 | "Like `make-directory' for Tramp files." |
| @@ -3932,6 +3951,7 @@ The method used must be an out-of-band method." | |||
| 3932 | "Like `delete-directory' for Tramp files." | 3951 | "Like `delete-directory' for Tramp files." |
| 3933 | (setq directory (expand-file-name directory)) | 3952 | (setq directory (expand-file-name directory)) |
| 3934 | (with-parsed-tramp-file-name directory nil | 3953 | (with-parsed-tramp-file-name directory nil |
| 3954 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 3935 | (tramp-flush-directory-property v localname) | 3955 | (tramp-flush-directory-property v localname) |
| 3936 | (unless (zerop (tramp-send-command-and-check | 3956 | (unless (zerop (tramp-send-command-and-check |
| 3937 | v | 3957 | v |
| @@ -3945,6 +3965,7 @@ The method used must be an out-of-band method." | |||
| 3945 | "Like `delete-file' for Tramp files." | 3965 | "Like `delete-file' for Tramp files." |
| 3946 | (setq filename (expand-file-name filename)) | 3966 | (setq filename (expand-file-name filename)) |
| 3947 | (with-parsed-tramp-file-name filename nil | 3967 | (with-parsed-tramp-file-name filename nil |
| 3968 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 3948 | (tramp-flush-file-property v localname) | 3969 | (tramp-flush-file-property v localname) |
| 3949 | (unless (zerop (tramp-send-command-and-check | 3970 | (unless (zerop (tramp-send-command-and-check |
| 3950 | v | 3971 | v |
| @@ -3974,6 +3995,7 @@ This is like `dired-recursive-delete-directory' for Tramp files." | |||
| 3974 | ;; This might take a while, allow it plenty of time. | 3995 | ;; This might take a while, allow it plenty of time. |
| 3975 | (tramp-wait-for-output (tramp-get-connection-process v) 120) | 3996 | (tramp-wait-for-output (tramp-get-connection-process v) 120) |
| 3976 | ;; Make sure that it worked... | 3997 | ;; Make sure that it worked... |
| 3998 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 3977 | (tramp-flush-directory-property v localname) | 3999 | (tramp-flush-directory-property v localname) |
| 3978 | (and (file-exists-p filename) | 4000 | (and (file-exists-p filename) |
| 3979 | (tramp-error | 4001 | (tramp-error |
| @@ -4953,11 +4975,9 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 4953 | (or (file-directory-p localname) | 4975 | (or (file-directory-p localname) |
| 4954 | (file-writable-p localname))))) | 4976 | (file-writable-p localname))))) |
| 4955 | ;; Short track: if we are on the local host, we can run directly. | 4977 | ;; Short track: if we are on the local host, we can run directly. |
| 4956 | (progn | 4978 | (tramp-run-real-handler |
| 4957 | (tramp-run-real-handler | 4979 | 'write-region |
| 4958 | 'write-region | 4980 | (list start end localname append 'no-message lockname confirm)) |
| 4959 | (list start end localname append 'no-message lockname confirm)) | ||
| 4960 | (tramp-flush-file-property v localname)) | ||
| 4961 | 4981 | ||
| 4962 | (let ((rem-dec (tramp-get-remote-coding v "remote-decoding")) | 4982 | (let ((rem-dec (tramp-get-remote-coding v "remote-decoding")) |
| 4963 | (loc-enc (tramp-get-local-coding v "local-encoding")) | 4983 | (loc-enc (tramp-get-local-coding v "local-encoding")) |
| @@ -5121,8 +5141,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5121 | " decode using `%s' failed") | 5141 | " decode using `%s' failed") |
| 5122 | filename rem-dec))) | 5142 | filename rem-dec))) |
| 5123 | (tramp-message | 5143 | (tramp-message |
| 5124 | v 5 "Decoding region into remote file %s...done" filename) | 5144 | v 5 "Decoding region into remote file %s...done" filename)) |
| 5125 | (tramp-flush-file-property v localname)) | ||
| 5126 | 5145 | ||
| 5127 | ;; Save exit. | 5146 | ;; Save exit. |
| 5128 | (delete-file tmpfile))) | 5147 | (delete-file tmpfile))) |
| @@ -5139,6 +5158,9 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." | |||
| 5139 | (when coding-system-used | 5158 | (when coding-system-used |
| 5140 | (set 'last-coding-system-used coding-system-used)))) | 5159 | (set 'last-coding-system-used coding-system-used)))) |
| 5141 | 5160 | ||
| 5161 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 5162 | (tramp-flush-file-property v localname) | ||
| 5163 | |||
| 5142 | ;; We must protect `last-coding-system-used', now we have set it | 5164 | ;; We must protect `last-coding-system-used', now we have set it |
| 5143 | ;; to its correct value. | 5165 | ;; to its correct value. |
| 5144 | (let (last-coding-system-used (need-chown t)) | 5166 | (let (last-coding-system-used (need-chown t)) |