[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] emacs/lisp/net tramp.el
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] emacs/lisp/net tramp.el |
Date: |
Sun, 07 Jun 2009 16:16:06 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Michael Albinus <albinus> 09/06/07 16:16:06
Modified files:
lisp/net : tramp.el
Log message:
* net/tramp.el (tramp-do-copy-or-rename-file-directly): Make direct
copy more robust, especially when "chown" is not applicable.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.235&r2=1.236
Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -b -r1.235 -r1.236
--- tramp.el 6 Jun 2009 23:25:06 -0000 1.235
+++ tramp.el 7 Jun 2009 16:16:05 -0000 1.236
@@ -3270,16 +3270,26 @@
(t
;; Create the temporary file.
(let ((tmpfile (tramp-compat-make-temp-file localname1)))
- (condition-case err
+ (unwind-protect
(progn
(cond
(t1
- (tramp-send-command
+ (or
+ (zerop
+ (tramp-send-command-and-check
v (format
"%s %s %s" cmd
(tramp-shell-quote-argument localname1)
- (tramp-shell-quote-argument tmpfile)))
+ (tramp-shell-quote-argument tmpfile))))
+ (tramp-error-with-buffer
+ nil v 'file-error
+ "Copying directly failed, see buffer `%s' for details."
+ (tramp-get-buffer v)))
;; We must change the ownership as remote user.
+ ;; Since this does not work reliable, we also
+ ;; give read permissions.
+ (set-file-modes
+ (concat prefix tmpfile) (tramp-octal-to-decimal "0777"))
(tramp-set-file-uid-gid
(concat prefix tmpfile)
(tramp-get-local-uid 'integer)
@@ -3293,6 +3303,9 @@
'rename-file
(list localname1 tmpfile t)))
;; We must change the ownership as local user.
+ ;; Since this does not work reliable, we also
+ ;; give read permissions.
+ (set-file-modes tmpfile (tramp-octal-to-decimal "0777"))
(tramp-set-file-uid-gid
tmpfile
(tramp-get-remote-uid v 'integer)
@@ -3301,20 +3314,26 @@
;; Move the temporary file to its destination.
(cond
(t2
- (tramp-send-command
+ (or
+ (zerop
+ (tramp-send-command-and-check
v (format
- "mv -f %s %s"
+ "cp -f -p %s %s"
(tramp-shell-quote-argument tmpfile)
(tramp-shell-quote-argument localname2))))
+ (tramp-error-with-buffer
+ nil v 'file-error
+ "Copying directly failed, see buffer `%s' for details."
+ (tramp-get-buffer v))))
(t1
(tramp-run-real-handler
'rename-file
(list tmpfile localname2 ok-if-already-exists)))))
- ;; Error handling.
- ((error quit)
+ ;; Save exit.
+ (condition-case nil
(delete-file tmpfile)
- (signal (car err) (cdr err))))))))))
+ (error)))))))))
;; Set the time and mode. Mask possible errors.
;; Won't be applied for 'rename.
- [Emacs-diffs] emacs/lisp/net tramp.el, Michael Albinus, 2009/06/06
- [Emacs-diffs] emacs/lisp/net tramp.el,
Michael Albinus <=
- [Emacs-diffs] emacs/lisp/net tramp.el, Michael Albinus, 2009/06/22
- [Emacs-diffs] emacs/lisp/net tramp.el, Michael Albinus, 2009/06/29
- [Emacs-diffs] emacs/lisp/net tramp.el, Michael Albinus, 2009/06/30
- [Emacs-diffs] emacs/lisp/net tramp.el, Michael Albinus, 2009/06/30
- [Emacs-diffs] emacs/lisp/net tramp.el, Michael Albinus, 2009/06/30