[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r99600: * net/tramp.el (tramp-do-copy
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r99600: * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an |
Date: |
Tue, 02 Mar 2010 10:32:45 +0100 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 99600
committer: Michael Albinus <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-02 10:32:45 +0100
message:
* 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.
modified:
lisp/ChangeLog
lisp/net/tramp-compat.el
lisp/net/tramp.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2010-03-02 03:27:41 +0000
+++ b/lisp/ChangeLog 2010-03-02 09:32:45 +0000
@@ -1,3 +1,11 @@
+2010-03-02 Michael Albinus <address@hidden>
+
+ * 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.
+
2010-03-02 Glenn Morris <address@hidden>
* calendar/cal-hebrew.el (holiday-hebrew-passover): Fix date
=== modified file 'lisp/net/tramp-compat.el'
--- a/lisp/net/tramp-compat.el 2010-01-13 08:35:10 +0000
+++ b/lisp/net/tramp-compat.el 2010-03-02 09:32:45 +0000
@@ -215,7 +215,7 @@
;; has been introduced with Emacs 22. We try it, if it fails, we fall
;; back to `make-temp-name', creating the temporary file immediately
;; in order to avoid a security hole.
-(defsubst tramp-compat-make-temp-file (filename)
+(defsubst tramp-compat-make-temp-file (filename &optional dir-flag)
"Create a temporary file (compat function).
Add the extension of FILENAME, if existing."
(let* (file-name-handler-alist
@@ -226,21 +226,24 @@
result)
(condition-case nil
(setq result
- (funcall (symbol-function 'make-temp-file) prefix nil extension))
+ (funcall
+ (symbol-function 'make-temp-file) prefix dir-flag extension))
(error
;; We use our own implementation, taken from files.el.
(while
(condition-case ()
(progn
(setq result (concat (make-temp-name prefix) extension))
- (write-region
- "" nil result nil 'silent nil
- ;; 7th parameter is MUSTBENEW in Emacs, and
- ;; CODING-SYSTEM in XEmacs. It is not a security
- ;; hole in XEmacs if we cannot use this parameter,
- ;; because XEmacs uses a user-specific subdirectory
- ;; with 0700 permissions.
- (when (not (featurep 'xemacs)) 'excl))
+ (if dir-flag
+ (make-directory result)
+ (write-region
+ "" nil result nil 'silent nil
+ ;; 7th parameter is MUSTBENEW in Emacs, and
+ ;; CODING-SYSTEM in XEmacs. It is not a security
+ ;; hole in XEmacs if we cannot use this parameter,
+ ;; because XEmacs uses a user-specific
+ ;; subdirectory with 0700 permissions.
+ (when (not (featurep 'xemacs)) 'excl)))
nil)
(file-already-exists t))
;; The file was somehow created by someone else between
=== modified file 'lisp/net/tramp.el'
--- a/lisp/net/tramp.el 2010-02-28 11:36:39 +0000
+++ b/lisp/net/tramp.el 2010-03-02 09:32:45 +0000
@@ -3798,13 +3798,12 @@
;; Both are Tramp files. We shall optimize it, when the
;; methods for filename and newname are the same.
- (let ((tmpfile
- (if (file-regular-p filename)
- (tramp-compat-make-temp-file localname)
- (make-temp-name
- (expand-file-name
- tramp-temp-name-prefix
- (tramp-compat-temporary-file-directory))))))
+ (let* ((dir-flag (file-directory-p filename))
+ (tmpfile (tramp-compat-make-temp-file localname dir-flag)))
+ (if dir-flag
+ (setq tmpfile
+ (expand-file-name
+ (file-name-nondirectory newname) tmpfile)))
(unwind-protect
(progn
(tramp-do-copy-or-rename-file-out-of-band
@@ -3813,9 +3812,10 @@
'rename tmpfile newname keep-date))
;; Save exit.
(condition-case nil
- (if (file-regular-p tmpfile)
- (delete-file tmpfile)
- (delete-directory tmpfile 'recursive))
+ (if dir-flag
+ (delete-directory
+ (expand-file-name ".." tmpfile) 'recursive)
+ (delete-file tmpfile))
(error))))
;; Expand hops. Might be necessary for gateway methods.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r99600: * net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Fix an,
Michael Albinus <=