diff options
| author | Michael Albinus | 2010-03-02 10:32:45 +0100 |
|---|---|---|
| committer | Michael Albinus | 2010-03-02 10:32:45 +0100 |
| commit | 9cf3544e3bc88406c361bff9f7a7592d26feebe5 (patch) | |
| tree | ca1e2a7f6cdee32ae2354a12952a9a44919b21b0 | |
| parent | 714997deb4344d87d0e24d38f8f05087c4aa86d8 (diff) | |
| download | emacs-9cf3544e3bc88406c361bff9f7a7592d26feebe5.tar.gz emacs-9cf3544e3bc88406c361bff9f7a7592d26feebe5.zip | |
* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an
error when FILENAME and NEWNAME are existing remote directories.
* net/tramp-compat.el (tramp-compat-make-temp-file): Add optional
parameter DIR-FLAG.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/net/tramp-compat.el | 23 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 20 |
3 files changed, 31 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ca850a4db59..7beebd130b1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-03-02 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an | ||
| 4 | error when FILENAME and NEWNAME are existing remote directories. | ||
| 5 | |||
| 6 | * net/tramp-compat.el (tramp-compat-make-temp-file): Add optional | ||
| 7 | parameter DIR-FLAG. | ||
| 8 | |||
| 1 | 2010-03-02 Glenn Morris <rgm@gnu.org> | 9 | 2010-03-02 Glenn Morris <rgm@gnu.org> |
| 2 | 10 | ||
| 3 | * calendar/cal-hebrew.el (holiday-hebrew-passover): Fix date | 11 | * calendar/cal-hebrew.el (holiday-hebrew-passover): Fix date |
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 4f930d58cdc..9bcbe21116d 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el | |||
| @@ -215,7 +215,7 @@ this is the function `temp-directory'." | |||
| 215 | ;; has been introduced with Emacs 22. We try it, if it fails, we fall | 215 | ;; has been introduced with Emacs 22. We try it, if it fails, we fall |
| 216 | ;; back to `make-temp-name', creating the temporary file immediately | 216 | ;; back to `make-temp-name', creating the temporary file immediately |
| 217 | ;; in order to avoid a security hole. | 217 | ;; in order to avoid a security hole. |
| 218 | (defsubst tramp-compat-make-temp-file (filename) | 218 | (defsubst tramp-compat-make-temp-file (filename &optional dir-flag) |
| 219 | "Create a temporary file (compat function). | 219 | "Create a temporary file (compat function). |
| 220 | Add the extension of FILENAME, if existing." | 220 | Add the extension of FILENAME, if existing." |
| 221 | (let* (file-name-handler-alist | 221 | (let* (file-name-handler-alist |
| @@ -226,21 +226,24 @@ Add the extension of FILENAME, if existing." | |||
| 226 | result) | 226 | result) |
| 227 | (condition-case nil | 227 | (condition-case nil |
| 228 | (setq result | 228 | (setq result |
| 229 | (funcall (symbol-function 'make-temp-file) prefix nil extension)) | 229 | (funcall |
| 230 | (symbol-function 'make-temp-file) prefix dir-flag extension)) | ||
| 230 | (error | 231 | (error |
| 231 | ;; We use our own implementation, taken from files.el. | 232 | ;; We use our own implementation, taken from files.el. |
| 232 | (while | 233 | (while |
| 233 | (condition-case () | 234 | (condition-case () |
| 234 | (progn | 235 | (progn |
| 235 | (setq result (concat (make-temp-name prefix) extension)) | 236 | (setq result (concat (make-temp-name prefix) extension)) |
| 236 | (write-region | 237 | (if dir-flag |
| 237 | "" nil result nil 'silent nil | 238 | (make-directory result) |
| 238 | ;; 7th parameter is MUSTBENEW in Emacs, and | 239 | (write-region |
| 239 | ;; CODING-SYSTEM in XEmacs. It is not a security | 240 | "" nil result nil 'silent nil |
| 240 | ;; hole in XEmacs if we cannot use this parameter, | 241 | ;; 7th parameter is MUSTBENEW in Emacs, and |
| 241 | ;; because XEmacs uses a user-specific subdirectory | 242 | ;; CODING-SYSTEM in XEmacs. It is not a security |
| 242 | ;; with 0700 permissions. | 243 | ;; hole in XEmacs if we cannot use this parameter, |
| 243 | (when (not (featurep 'xemacs)) 'excl)) | 244 | ;; because XEmacs uses a user-specific |
| 245 | ;; subdirectory with 0700 permissions. | ||
| 246 | (when (not (featurep 'xemacs)) 'excl))) | ||
| 244 | nil) | 247 | nil) |
| 245 | (file-already-exists t)) | 248 | (file-already-exists t)) |
| 246 | ;; The file was somehow created by someone else between | 249 | ;; The file was somehow created by someone else between |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 0957c78eddf..c029f073724 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -3798,13 +3798,12 @@ The method used must be an out-of-band method." | |||
| 3798 | 3798 | ||
| 3799 | ;; Both are Tramp files. We shall optimize it, when the | 3799 | ;; Both are Tramp files. We shall optimize it, when the |
| 3800 | ;; methods for filename and newname are the same. | 3800 | ;; methods for filename and newname are the same. |
| 3801 | (let ((tmpfile | 3801 | (let* ((dir-flag (file-directory-p filename)) |
| 3802 | (if (file-regular-p filename) | 3802 | (tmpfile (tramp-compat-make-temp-file localname dir-flag))) |
| 3803 | (tramp-compat-make-temp-file localname) | 3803 | (if dir-flag |
| 3804 | (make-temp-name | 3804 | (setq tmpfile |
| 3805 | (expand-file-name | 3805 | (expand-file-name |
| 3806 | tramp-temp-name-prefix | 3806 | (file-name-nondirectory newname) tmpfile))) |
| 3807 | (tramp-compat-temporary-file-directory)))))) | ||
| 3808 | (unwind-protect | 3807 | (unwind-protect |
| 3809 | (progn | 3808 | (progn |
| 3810 | (tramp-do-copy-or-rename-file-out-of-band | 3809 | (tramp-do-copy-or-rename-file-out-of-band |
| @@ -3813,9 +3812,10 @@ The method used must be an out-of-band method." | |||
| 3813 | 'rename tmpfile newname keep-date)) | 3812 | 'rename tmpfile newname keep-date)) |
| 3814 | ;; Save exit. | 3813 | ;; Save exit. |
| 3815 | (condition-case nil | 3814 | (condition-case nil |
| 3816 | (if (file-regular-p tmpfile) | 3815 | (if dir-flag |
| 3817 | (delete-file tmpfile) | 3816 | (delete-directory |
| 3818 | (delete-directory tmpfile 'recursive)) | 3817 | (expand-file-name ".." tmpfile) 'recursive) |
| 3818 | (delete-file tmpfile)) | ||
| 3819 | (error)))) | 3819 | (error)))) |
| 3820 | 3820 | ||
| 3821 | ;; Expand hops. Might be necessary for gateway methods. | 3821 | ;; Expand hops. Might be necessary for gateway methods. |