From: Michael Albinus <michael.albinus@gmx.de>
To: Jo Vermeulen <jo.vermeulen@gmail.com>
Cc: 7289@debbugs.gnu.org
Subject: bug#7289: Tramp changes ownership of remote file when saving
Date: Thu, 28 Oct 2010 14:37:18 +0200 [thread overview]
Message-ID: <874oc6ze69.fsf@gmx.de> (raw)
In-Reply-To: <AANLkTi=sTcodv14keDU7WDNW2aziStFCN2H=bsFjTA9E@mail.gmail.com> (Jo Vermeulen's message of "Wed, 27 Oct 2010 17:21:45 +0200")
Jo Vermeulen <jo.vermeulen@gmail.com> writes:
> I don't think many people will run Emacs as root in this day and age.
> However, they might log in as root on a remote server, or edit a file
> as root (using sudo/su). Maybe Emacs or Tramp should also
> automatically set the backup-by-copying-when-mismatch variable to t in
> those cases?
Could you, please, try the following patch? It is towards the Emacs-23
branch, line numbers might differ with your tramp.el.
--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs-23/lisp/net/tramp.el.~100136~ 2010-10-28 14:31:49.730285001 +0200
--- /home/albinus/src/emacs-23/lisp/net/tramp.el 2010-10-28 14:29:40.990285001 +0200
***************
*** 5008,5014 ****
(setq buffer-file-name filename)
(setq buffer-read-only (not (file-writable-p filename)))
(set-visited-file-modtime)
! (set-buffer-modified-p nil))
(when (and (stringp local-copy)
(or remote-copy (null tramp-temp-buffer-file-name)))
(delete-file local-copy))
--- 5008,5018 ----
(setq buffer-file-name filename)
(setq buffer-read-only (not (file-writable-p filename)))
(set-visited-file-modtime)
! (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))
--8<---------------cut here---------------end--------------->8---
> Thanks for your help!
>
> Cheers,
>
> -- Jo
Best regards, Michael.
next prev parent reply other threads:[~2010-10-28 12:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 10:46 bug#7289: Tramp changes ownership of remote file when saving Jo Vermeulen
2010-10-27 13:53 ` Stefan Monnier
2010-10-27 15:21 ` Jo Vermeulen
2010-10-28 12:37 ` Michael Albinus [this message]
2010-10-29 10:42 ` Jo Vermeulen
2010-10-29 11:25 ` Michael Albinus
2010-10-29 13:28 ` Jo Vermeulen
2010-10-29 19:31 ` Michael Albinus
2010-10-31 19:15 ` Stefan Monnier
2010-11-01 7:33 ` Michael Albinus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874oc6ze69.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=7289@debbugs.gnu.org \
--cc=jo.vermeulen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).