all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jo Vermeulen <jo.vermeulen@gmail.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 7289@debbugs.gnu.org
Subject: bug#7289: Tramp changes ownership of remote file when saving
Date: Fri, 29 Oct 2010 12:42:18 +0200	[thread overview]
Message-ID: <AANLkTi=qkH3V-Sd7P5NKF8yLpbEkoXZWLN_iW+A3g_KW@mail.gmail.com> (raw)
In-Reply-To: <874oc6ze69.fsf@gmx.de>

On Thu, Oct 28, 2010 at 2:37 PM, Michael Albinus <michael.albinus@gmx.de> wrote:
> 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---

To which function does this patch apply? Couldn't immediately find it,
but my code might be different from the current Emacs 23 branch ...

Thanks!

-- Jo

-- Jo





  reply	other threads:[~2010-10-29 10:42 UTC|newest]

Thread overview: 15+ 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
2010-10-29 10:42       ` Jo Vermeulen [this message]
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
2010-11-01 14:12           ` backup-by-copying-when-mismatch (was: bug#7289: Tramp changes ownership of remote file when saving) Stefan Monnier
2010-11-04 14:51             ` backup-by-copying-when-mismatch Michael Albinus
2010-11-20 10:49               ` backup-by-copying-when-mismatch Michael Albinus
2010-11-21 17:16                 ` backup-by-copying-when-mismatch Stefan Monnier
2010-11-21 19:48                   ` backup-by-copying-when-mismatch 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=qkH3V-Sd7P5NKF8yLpbEkoXZWLN_iW+A3g_KW@mail.gmail.com' \
    --to=jo.vermeulen@gmail.com \
    --cc=7289@debbugs.gnu.org \
    --cc=michael.albinus@gmx.de \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.