From: Michael Albinus Date: Sat, 30 Oct 2010 16:28:17 +0000 (+0200) Subject: * net/tramp.el (tramp-handle-insert-file-contents): For root, X-Git-Tag: emacs-pretest-23.2.90~37 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a057950d77bbd03434f6a286c81a259824d7b7ad;p=emacs.git * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0a6999a81c1..3944fdebc69 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2010-10-30 Michael Albinus + + * net/tramp.el (tramp-handle-insert-file-contents): For root, + preserve owner and group when editing files. (Bug#7289) + 2010-10-29 Glenn Morris * speedbar.el (speedbar-mode): diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 426785dd9a4..50fbaed01e0 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -5008,7 +5008,11 @@ coding system might not be determined. This function repairs it." (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))