changeset 111258:962192b1bc2a

* net/tramp.el (tramp-handle-insert-file-contents): For root, preserve owner and group when editing files. (Bug#7289) Please contact me, if you have problems syncing with the trunk.
author Michael Albinus <michael.albinus@gmx.de>
date Sat, 30 Oct 2010 18:28:17 +0200
parents 516f3d80dac6
children 713404bdbb3e
files lisp/ChangeLog lisp/net/tramp.el
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Oct 29 00:48:10 2010 -0700
+++ b/lisp/ChangeLog	Sat Oct 30 18:28:17 2010 +0200
@@ -1,3 +1,8 @@
+2010-10-30  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-handle-insert-file-contents): For root,
+	preserve owner and group when editing files.  (Bug#7289)
+
 2010-10-29  Glenn Morris  <rgm@gnu.org>
 
 	* speedbar.el (speedbar-mode):
--- a/lisp/net/tramp.el	Fri Oct 29 00:48:10 2010 -0700
+++ b/lisp/net/tramp.el	Sat Oct 30 18:28:17 2010 +0200
@@ -5008,7 +5008,11 @@
 	    (setq buffer-file-name filename)
 	    (setq buffer-read-only (not (file-writable-p filename)))
 	    (set-visited-file-modtime)
-	    (set-buffer-modified-p nil))
+	    (set-buffer-modified-p nil)
+	    ;; For root, preserve owner and group when editing files.
+	    (when (string-equal (file-remote-p filename 'user) "root")
+	      (set (make-local-variable 'backup-by-copying-when-mismatch) t)
+	      (put 'backup-by-copying-when-mismatch 'permanent-local t)))
 	  (when (and (stringp local-copy)
 		     (or remote-copy (null tramp-temp-buffer-file-name)))
 	    (delete-file local-copy))