changeset 107209:4a0ca858272e

* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect setting the modes by `ignore-errors'. It might fail, for example if the file is not owned by the user but the group. (tramp-handle-write-region): Ensure, that `tmpfile' is always readable.
author Michael Albinus <michael.albinus@gmx.de>
date Mon, 22 Feb 2010 14:48:52 +0100
parents 8554c569b8fd
children e547a98225c5 edfde380e83e
files lisp/ChangeLog lisp/net/tramp.el
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Feb 21 16:12:46 2010 -0500
+++ b/lisp/ChangeLog	Mon Feb 22 14:48:52 2010 +0100
@@ -1,3 +1,10 @@
+2010-02-22  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-do-copy-or-rename-file-out-of-band): Protect
+	setting the modes by `ignore-errors'.  It might fail, for example
+	if the file is not owned by the user but the group.
+	(tramp-handle-write-region): Ensure, that `tmpfile' is always readable.
+
 2010-02-21  Chong Yidong  <cyd@stupidchicken.com>
 
 	* files.el (directory-listing-before-filename-regexp): Use
--- a/lisp/net/tramp.el	Sun Feb 21 16:12:46 2010 -0500
+++ b/lisp/net/tramp.el	Mon Feb 22 14:48:52 2010 +0100
@@ -3926,7 +3926,8 @@
 
 	;; Set the mode.
 	(unless (and keep-date copy-keep-date)
-	  (set-file-modes newname (tramp-default-file-modes filename))))
+	  (ignore-errors
+	    (set-file-modes newname (tramp-default-file-modes filename)))))
 
       ;; If the operation was `rename', delete the original file.
       (unless (eq op 'copy)
@@ -5031,7 +5032,10 @@
 	  ;; filename does not exist (eq modes nil) it has been
 	  ;; renamed to the backup file.  This case `save-buffer'
 	  ;; handles permissions.
-	  (when modes (set-file-modes tmpfile modes))
+	  ;; Ensure, that it is still readable.
+	  (when modes
+	    (set-file-modes
+	     tmpfile (logior (or modes 0) (tramp-octal-to-decimal "0400"))))
 
 	  ;; This is a bit lengthy due to the different methods
 	  ;; possible for file transfer.  First, we check whether the