From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Jo Vermeulen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Oct 2010 10:54:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 7289@debbugs.gnu.org X-Debbugs-Original-To: submit Received: via spool by submit@debbugs.gnu.org id=B.128817679410955 (code B ref -1); Wed, 27 Oct 2010 10:54:03 +0000 Received: (at submit) by debbugs.gnu.org; 27 Oct 2010 10:53:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB3d2-0002qc-U7 for submit@debbugs.gnu.org; Wed, 27 Oct 2010 06:53:13 -0400 Received: from mail-qw0-f44.google.com ([209.85.216.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB3Sb-0002lD-Sc for submit@debbugs.gnu.org; Wed, 27 Oct 2010 06:42:26 -0400 Received: by qwb7 with SMTP id 7so555438qwb.3 for ; Wed, 27 Oct 2010 03:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=iDgdF7Frk93sBeWBr5LIpHhofN6MTyWVZpPFaJ0Wv+Y=; b=byPfHIZjVNesJPBVXOsryehPzovCvWlu9bqC65f6zxauQbBlD+Qj0e0wB3gcU1C2dE CQ2DtTz7IxuMtE6vCg4Vap26weijgWBlIkH2y1kbRkDjhYut3aV0GoVfwJEo45GAApCt 3HeQs45V6Okl4RHcjQdc3V2nrSiVafQhAqCwg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=xtjifvAv5taBHqxT5qndoORP60cbso6s8vn95LJC14lGASoozzN9Y1QlTBvQQywpV1 rHqcKAMppgKD//0Iiur4n5Er/i/AGftiSFK400Rn5lO6DI4GfopHOAHi52A3o14ZUupl XlcA0FGcYf3PfRFauJ6p5HEpI+U/CTXTuaYpg= Received: by 10.229.240.79 with SMTP id kz15mr1308197qcb.200.1288176391990; Wed, 27 Oct 2010 03:46:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.127.99 with HTTP; Wed, 27 Oct 2010 03:46:11 -0700 (PDT) From: Jo Vermeulen Date: Wed, 27 Oct 2010 12:46:11 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-Mailman-Approved-At: Wed, 27 Oct 2010 06:53:10 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Package: emacs Version: 23.1 Severity: important When editing a remote file over SSH using tramp, emacs changes the ownership of the file. I was logged in as root, and the file had ownership svn:svn. After saving, however, emacs changed the ownership to root:root. The backup file (filename~) did have the user/group settings however. This behavior is quite annoying, as one often doesn't realize the ownership has changed. This might result in services that are unable to read their basic configuration files after they have been edited remotely with emacs. P.S.: my apologies for double-posting, I first thought the package name should be tramp instead of emacs. Here's more information about my specific version of Emacs (running on Ubuntu 10.10): In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-03-29 on rothera, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10900000 configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Help Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t view-mode: t Recent input: C-x C-d / u s r s h e m a / 2 3 e p r P R C-x o C-x o C-x o C-x 1 M-x d i r e - m o d w d i r d i r e d - m C-s P R O B L E M C-s t r a m p C-s r e m o t e C-s C-s C-s s s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-x k C-x k M-x r e p o r t - e m a c s Recent messages: Loading /etc/emacs/site-start.d/50org-mode.el (source)...done Loading /etc/emacs/site-start.d/50psvn.el (source)...done Loading /etc/emacs/site-start.d/50w3m-el.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... [2 times] help-follow: No cross-reference here [3 times] Making completion list... [2 times] Mark saved where search started Note: file is write protected Mark saved where search started From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Oct 2010 13:50:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jo Vermeulen Cc: 7289@debbugs.gnu.org Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.128818739120957 (code B ref 7289); Wed, 27 Oct 2010 13:50:03 +0000 Received: (at 7289) by debbugs.gnu.org; 27 Oct 2010 13:49:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB6Nz-0005Ry-Mv for submit@debbugs.gnu.org; Wed, 27 Oct 2010 09:49:51 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB6Ny-0005Rr-2Z for 7289@debbugs.gnu.org; Wed, 27 Oct 2010 09:49:50 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgcKAJvLx0xFxL/T/2dsb2JhbACgWn5yvRWFSASSKg X-IronPort-AV: E=Sophos;i="4.58,246,1286164800"; d="scan'208";a="80814372" Received: from 69-196-191-211.dsl.teksavvy.com (HELO pastel.home) ([69.196.191.211]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 27 Oct 2010 09:53:56 -0400 Received: by pastel.home (Postfix, from userid 20848) id CDA55A8554; Wed, 27 Oct 2010 09:53:55 -0400 (EDT) From: Stefan Monnier Message-ID: References: Date: Wed, 27 Oct 2010 09:53:55 -0400 In-Reply-To: (Jo Vermeulen's message of "Wed, 27 Oct 2010 12:46:11 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > When editing a remote file over SSH using tramp, emacs changes the ownership > of the file. I was logged in as root, and the file had ownership svn:svn. > After saving, however, emacs changed the ownership to root:root. The backup > file (filename~) did have the user/group settings however. What are your settings for backup-by-copying and backup-by-copying-when-mismatch? Stefan From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Jo Vermeulen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Oct 2010 15:18:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 7289@debbugs.gnu.org Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.128819268123225 (code B ref 7289); Wed, 27 Oct 2010 15:18:03 +0000 Received: (at 7289) by debbugs.gnu.org; 27 Oct 2010 15:18:01 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB7lJ-00062Y-AI for submit@debbugs.gnu.org; Wed, 27 Oct 2010 11:18:01 -0400 Received: from mail-qw0-f44.google.com ([209.85.216.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB7lH-00062R-CC for 7289@debbugs.gnu.org; Wed, 27 Oct 2010 11:18:00 -0400 Received: by qwb7 with SMTP id 7so798272qwb.3 for <7289@debbugs.gnu.org>; Wed, 27 Oct 2010 08:22:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=udkyTdSC0lZZBn+2swnJx7ulHApp6H/IVN7GFTSXQVA=; b=j6+YfMSpptiLKa5V91GksjSgXZ/PrVxxch3a3MkXBefn0ofEK2iitw/2LemN3GpHv8 NbyFvaANa+gBWSkAjPjD9xcgkxN9kOEVmdbwdC1/xPH/wTooepQa3yYYKdrP6IICuuJF XGlLpv/tpfm4urAVbs99jWdcE8du35pWEeIGk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=Q5+P3kRPuMDVW/mFUuOK4X+hwIJo0HbYQ16Chq7DkH/iHozFiRcHfL6LKf6BWfyyDu BA5BRV7LK5aPu0og3cra72UrWWfR+nwuc7bAgdEp6BvYK0IKd8PRIFZNJY1pORiKJP1w Vrjk9m7PM2CHolCEy/a8aeCqxdKrd5llTMAYA= Received: by 10.229.236.14 with SMTP id ki14mr6389576qcb.78.1288192925999; Wed, 27 Oct 2010 08:22:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.127.99 with HTTP; Wed, 27 Oct 2010 08:21:45 -0700 (PDT) In-Reply-To: References: From: Jo Vermeulen Date: Wed, 27 Oct 2010 17:21:45 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Wed, Oct 27, 2010 at 3:53 PM, Stefan Monnier wrote: >> When editing a remote file over SSH using tramp, emacs changes the ownership >> of the file. I was logged in as root, and the file had ownership svn:svn. >> After saving, however, emacs changed the ownership to root:root. The backup >> file (filename~) did have the user/group settings however. > > What are your settings for backup-by-copying and > backup-by-copying-when-mismatch? C-h-v backup-by-coping gives me: "backup-by-copying's value is nil" Which, I assume, means that Emacs might use renaming for backups. And C-h-v backup-by-coping-when-mismatch results in: "backup-by-copying-when-mismatch's value is nil" I guess if this value would be non-nil, my problem would be solved? Additionally, C-h-v backup-by-copying-when-privileged-mismatch gives me: "backup-by-copying-when-privileged-mismatch's value is 200" I just toggled backup-by-copying-when-mismatch and tried it again, and indeed, it does work now. I'm just wondering if this means that the default behavior is broken? It seems Emacs automatically sets backup-by-copying-when-mismatch to t when it is run by the superuser (root) to overcome this problem (source: http://www.delorie.com/gnu/docs/emacs/emacs_117.html). 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? Thanks for your help! Cheers, -- Jo From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Michael Albinus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Oct 2010 12:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jo Vermeulen Cc: 7289@debbugs.gnu.org, Stefan Monnier Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.128826920132670 (code B ref 7289); Thu, 28 Oct 2010 12:34:03 +0000 Received: (at 7289) by debbugs.gnu.org; 28 Oct 2010 12:33:21 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBRfU-0008Ut-GA for submit@debbugs.gnu.org; Thu, 28 Oct 2010 08:33:20 -0400 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PBRfR-0008Un-Mx for 7289@debbugs.gnu.org; Thu, 28 Oct 2010 08:33:18 -0400 Received: (qmail invoked by alias); 28 Oct 2010 12:37:24 -0000 Received: from p4FC18D9F.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [79.193.141.159] by mail.gmx.net (mp016) with SMTP; 28 Oct 2010 14:37:24 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18M9Yl4MzsM1eaIuRtBVjFKdPyMWvlbeQp5wRa4Tg 1R8XXZIaZ1KoPn From: Michael Albinus References: Date: Thu, 28 Oct 2010 14:37:18 +0200 In-Reply-To: (Jo Vermeulen's message of "Wed, 27 Oct 2010 17:21:45 +0200") Message-ID: <874oc6ze69.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Jo Vermeulen 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. From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Jo Vermeulen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Oct 2010 10:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Albinus Cc: 7289@debbugs.gnu.org, Stefan Monnier Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.12883487116513 (code B ref 7289); Fri, 29 Oct 2010 10:39:02 +0000 Received: (at 7289) by debbugs.gnu.org; 29 Oct 2010 10:38:31 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBmLv-0001gz-0p for submit@debbugs.gnu.org; Fri, 29 Oct 2010 06:38:31 -0400 Received: from mail-qw0-f44.google.com ([209.85.216.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBmLr-0001gu-94 for 7289@debbugs.gnu.org; Fri, 29 Oct 2010 06:38:27 -0400 Received: by qwb7 with SMTP id 7so2978097qwb.3 for <7289@debbugs.gnu.org>; Fri, 29 Oct 2010 03:42:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=Ioob0qlY7vsIgDfbWqiOs7CdGiIhBLY3vC2etI/QL6c=; b=o0qtSTo776YNCL1B7eP1W47cGvEj1OdeTQomUs6taP99K2Mj0AgaB3DWoAV47TpuwV CTVqMjEYbLcwctLimebsGERxIGR7JIdfv/lAFHdzTE1ikoyntsShLrH+ktaVDF+cmqA4 zPBaelVtrog9ZuZJjLRn0Nqtptkh6w+ruxAB8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=OtqTeNs6BQ6QBUYQlIr6cGU7UsvudpWSvVlUYG0Vm/LJ7+4PEJ303eYrwQ7q1WXOu7 UTcdcgylzPK+oI1EzHxLmS/oApK9SYRP15GjscYyytcbYiqCHwz07UfD84mRwrXhyLyI MUpMvVKR9QTwb6Gi89WjKXLt/JDVqjo1mxplE= Received: by 10.229.238.82 with SMTP id kr18mr5036962qcb.242.1288348958437; Fri, 29 Oct 2010 03:42:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.127.99 with HTTP; Fri, 29 Oct 2010 03:42:18 -0700 (PDT) In-Reply-To: <874oc6ze69.fsf@gmx.de> References: <874oc6ze69.fsf@gmx.de> From: Jo Vermeulen Date: Fri, 29 Oct 2010 12:42:18 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Thu, Oct 28, 2010 at 2:37 PM, Michael Albinus w= rote: > Jo Vermeulen 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~ =C2=A0 =C2=A0 = =C2=A0 2010-10-28 14:31:49.730285001 +0200 > --- /home/albinus/src/emacs-23/lisp/net/tramp.el =C2=A0 =C2=A0 =C2=A0 =C2= =A02010-10-28 14:29:40.990285001 +0200 > *************** > *** 5008,5014 **** > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq buffer-file-name filename) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq buffer-read-only (not (fil= e-writable-p filename))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-visited-file-modtime) > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-buffer-modified-p nil)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (and (stringp local-copy) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or= remote-copy (null tramp-temp-buffer-file-name))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(delete-file local-copy)) > --- 5008,5018 ---- > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq buffer-file-name filename) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq buffer-read-only (not (fil= e-writable-p filename))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(set-visited-file-modtime) > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set-buffer-modified-p nil) > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; For root, preserve owner and grou= p when editing files. > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (when (string-equal (file-remote-p f= ilename 'user) "root") > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (set (make-local-variable 'ba= ckup-by-copying-when-mismatch) t) > ! =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (put 'backup-by-copying-when-= mismatch 'permanent-local t))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (and (stringp local-copy) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (or= remote-copy (null tramp-temp-buffer-file-name))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(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 From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Michael Albinus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Oct 2010 11:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Jo Vermeulen Cc: 7289@debbugs.gnu.org, Stefan Monnier Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.12883513017614 (code B ref 7289); Fri, 29 Oct 2010 11:22:01 +0000 Received: (at 7289) by debbugs.gnu.org; 29 Oct 2010 11:21:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBn1h-0001yl-BT for submit@debbugs.gnu.org; Fri, 29 Oct 2010 07:21:41 -0400 Received: from mailout-de.gmx.net ([213.165.64.22] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PBn1d-0001yg-Q8 for 7289@debbugs.gnu.org; Fri, 29 Oct 2010 07:21:39 -0400 Received: (qmail invoked by alias); 29 Oct 2010 11:25:47 -0000 Received: from p4FC19238.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [79.193.146.56] by mail.gmx.net (mp052) with SMTP; 29 Oct 2010 13:25:47 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/Q9iZllmDQ2uVNay+GJhsiEPtYsR74UiAwl58lEt wCN8PDZIoeHn/L From: Michael Albinus References: <874oc6ze69.fsf@gmx.de> Date: Fri, 29 Oct 2010 13:25:43 +0200 In-Reply-To: (Jo Vermeulen's message of "Fri, 29 Oct 2010 12:42:18 +0200") Message-ID: <871v79qlzc.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Jo Vermeulen writes: > To which function does this patch apply? Couldn't immediately find it, > but my code might be different from the current Emacs 23 branch ... tramp-handle-insert-file-contents If you are using Emacs' trunk, it would be another file / another function. > Thanks! > > -- Jo Best regards, Michael. From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Jo Vermeulen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Oct 2010 13:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Albinus Cc: 7289@debbugs.gnu.org, Stefan Monnier Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.128835866713466 (code B ref 7289); Fri, 29 Oct 2010 13:25:02 +0000 Received: (at 7289) by debbugs.gnu.org; 29 Oct 2010 13:24:27 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBowU-0003V9-LM for submit@debbugs.gnu.org; Fri, 29 Oct 2010 09:24:27 -0400 Received: from mail-qy0-f179.google.com ([209.85.216.179]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBowS-0003Uy-Lz for 7289@debbugs.gnu.org; Fri, 29 Oct 2010 09:24:25 -0400 Received: by qyk5 with SMTP id 5so3203158qyk.3 for <7289@debbugs.gnu.org>; Fri, 29 Oct 2010 06:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type; bh=3M5Tqj28DsW+gRgZtRtDsNDMxmtdcq4nS/WwEHc/1iE=; b=J9Vrx0m04I8IoiQpjzOQBGh2UyGxPPo/UdBotTesMLtLffFHpiNWX/1tbOMtkAU68U CRYri6DHxSQueYiFrxVAh2tIgxS8pEvbPerJm8qKqmPbRsibirII85Nj4lubfUdUUqni Bw5NYhiZ789Vs0EQmT9fB97jFARD33mdZuzXU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=tuqlPgIjTc14U7/sbXdcUgAbKVC0SX4+YFyhl+WbGUZOT2wvwC7S0SBsXbS8tpGxgc QOMRau8HPguHqArcsgbjIai1vC0TjUXPgOVU76cAAN2XvKZaVi+dfxnhB/g4m/fNl+5o WE3wdSUqIaHR8XIwlK3jC5sDQgRS6Kb0+d/iw= Received: by 10.229.35.5 with SMTP id n5mr11274668qcd.175.1288358914155; Fri, 29 Oct 2010 06:28:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.127.99 with HTTP; Fri, 29 Oct 2010 06:28:14 -0700 (PDT) In-Reply-To: <871v79qlzc.fsf@gmx.de> References: <874oc6ze69.fsf@gmx.de> <871v79qlzc.fsf@gmx.de> From: Jo Vermeulen Date: Fri, 29 Oct 2010 15:28:14 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Fri, Oct 29, 2010 at 1:25 PM, Michael Albinus wrote: > Jo Vermeulen writes: > >> To which function does this patch apply? Couldn't immediately find it, >> but my code might be different from the current Emacs 23 branch ... > > tramp-handle-insert-file-contents > > If you are using Emacs' trunk, it would be another file / another function. I changed it, and it seems to work now. However, I get this error (in *Messages*): apply: Symbol's value as variable is void: local-copy My tramp.el file can be found @ http://research.edm.uhasselt.be/~jvermeulen/tmp/emacs/tramp.el Cheers, -- Jo From unknown Fri Jun 20 20:09:35 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Jo Vermeulen Subject: bug#7289: closed (Re: bug#7289: Tramp changes ownership of remote file when saving) Message-ID: References: <87tyk4pzhn.fsf@gmx.de> X-Gnu-PR-Message: they-closed 7289 X-Gnu-PR-Package: emacs Reply-To: 7289@debbugs.gnu.org Date: Fri, 29 Oct 2010 19:28:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1288380482-23075-1" This is a multi-part message in MIME format... ------------=_1288380482-23075-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #7289: Tramp changes ownership of remote file when saving which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 7289@debbugs.gnu.org. --=20 7289: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D7289 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1288380482-23075-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 7289-done) by debbugs.gnu.org; 29 Oct 2010 19:27:25 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PBubk-0005zz-MG for submit@debbugs.gnu.org; Fri, 29 Oct 2010 15:27:24 -0400 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PBubj-0005zs-2c for 7289-done@debbugs.gnu.org; Fri, 29 Oct 2010 15:27:24 -0400 Received: (qmail invoked by alias); 29 Oct 2010 19:31:33 -0000 Received: from p4FC19238.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [79.193.146.56] by mail.gmx.net (mp061) with SMTP; 29 Oct 2010 21:31:33 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX18udvkcuPcuxjkjY2xvEc/0M4f5qnDsoajtq0pGCE l3+7euxbsc0LN5 From: Michael Albinus To: Jo Vermeulen Subject: Re: bug#7289: Tramp changes ownership of remote file when saving References: <874oc6ze69.fsf@gmx.de> <871v79qlzc.fsf@gmx.de> Date: Fri, 29 Oct 2010 21:31:32 +0200 In-Reply-To: (Jo Vermeulen's message of "Fri, 29 Oct 2010 15:28:14 +0200") Message-ID: <87tyk4pzhn.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 7289-done Cc: 7289-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Jo Vermeulen writes: > I changed it, and it seems to work now. However, I get this error (in > *Messages*): > > apply: Symbol's value as variable is void: local-copy I see. The lines (when (and (stringp local-copy) (or remote-copy (null tramp-temp-buffer-file-name))) (delete-file local-copy)) were added later as with Emacs 23.1, you can discard them. Thanks for testing, I'll commit the patch (and close the bug). > Cheers, > > -- Jo Best regards, Miochael. ------------=_1288380482-23075-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 Oct 2010 10:53:14 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB3d2-0002qc-U7 for submit@debbugs.gnu.org; Wed, 27 Oct 2010 06:53:13 -0400 Received: from mail-qw0-f44.google.com ([209.85.216.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PB3Sb-0002lD-Sc for submit@debbugs.gnu.org; Wed, 27 Oct 2010 06:42:26 -0400 Received: by qwb7 with SMTP id 7so555438qwb.3 for ; Wed, 27 Oct 2010 03:46:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=iDgdF7Frk93sBeWBr5LIpHhofN6MTyWVZpPFaJ0Wv+Y=; b=byPfHIZjVNesJPBVXOsryehPzovCvWlu9bqC65f6zxauQbBlD+Qj0e0wB3gcU1C2dE CQ2DtTz7IxuMtE6vCg4Vap26weijgWBlIkH2y1kbRkDjhYut3aV0GoVfwJEo45GAApCt 3HeQs45V6Okl4RHcjQdc3V2nrSiVafQhAqCwg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=xtjifvAv5taBHqxT5qndoORP60cbso6s8vn95LJC14lGASoozzN9Y1QlTBvQQywpV1 rHqcKAMppgKD//0Iiur4n5Er/i/AGftiSFK400Rn5lO6DI4GfopHOAHi52A3o14ZUupl XlcA0FGcYf3PfRFauJ6p5HEpI+U/CTXTuaYpg= Received: by 10.229.240.79 with SMTP id kz15mr1308197qcb.200.1288176391990; Wed, 27 Oct 2010 03:46:31 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.127.99 with HTTP; Wed, 27 Oct 2010 03:46:11 -0700 (PDT) From: Jo Vermeulen Date: Wed, 27 Oct 2010 12:46:11 +0200 Message-ID: Subject: Tramp changes ownership of remote file when saving To: submit Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 27 Oct 2010 06:53:10 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Package: emacs Version: 23.1 Severity: important When editing a remote file over SSH using tramp, emacs changes the ownership of the file. I was logged in as root, and the file had ownership svn:svn. After saving, however, emacs changed the ownership to root:root. The backup file (filename~) did have the user/group settings however. This behavior is quite annoying, as one often doesn't realize the ownership has changed. This might result in services that are unable to read their basic configuration files after they have been edited remotely with emacs. P.S.: my apologies for double-posting, I first thought the package name should be tramp instead of emacs. Here's more information about my specific version of Emacs (running on Ubuntu 10.10): In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-03-29 on rothera, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.10900000 configured using `configure '--build=i486-linux-gnu' '--host=i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.1/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.1/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.utf8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Help Minor modes in effect: tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t view-mode: t Recent input: C-x C-d / u s r s h e m a / 2 3 e p r P R C-x o C-x o C-x o C-x 1 M-x d i r e - m o d w d i r d i r e d - m C-s P R O B L E M C-s t r a m p C-s r e m o t e C-s C-s C-s s s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-s C-x k C-x k M-x r e p o r t - e m a c s Recent messages: Loading /etc/emacs/site-start.d/50org-mode.el (source)...done Loading /etc/emacs/site-start.d/50psvn.el (source)...done Loading /etc/emacs/site-start.d/50w3m-el.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. Making completion list... [2 times] help-follow: No cross-reference here [3 times] Making completion list... [2 times] Mark saved where search started Note: file is write protected Mark saved where search started ------------=_1288380482-23075-1-- From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 31 Oct 2010 19:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Michael Albinus Cc: 7289@debbugs.gnu.org, Jo Vermeulen Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.128855225312713 (code B ref 7289); Sun, 31 Oct 2010 19:11:01 +0000 Received: (at 7289) by debbugs.gnu.org; 31 Oct 2010 19:10:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCdIq-0003J0-Td for submit@debbugs.gnu.org; Sun, 31 Oct 2010 15:10:53 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCdIp-0003Iv-J1 for 7289@debbugs.gnu.org; Sun, 31 Oct 2010 15:10:51 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskIAJtczUxFpYZA/2dsb2JhbACgSX5yuVaFRASSKw X-IronPort-AV: E=Sophos;i="4.58,268,1286164800"; d="scan'208";a="81202626" Received: from 69-165-134-64.dsl.teksavvy.com (HELO pastel.home) ([69.165.134.64]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 31 Oct 2010 15:15:09 -0400 Received: by pastel.home (Postfix, from userid 20848) id CE2EBA8621; Sun, 31 Oct 2010 15:15:08 -0400 (EDT) From: Stefan Monnier Message-ID: References: <874oc6ze69.fsf@gmx.de> Date: Sun, 31 Oct 2010 15:15:08 -0400 In-Reply-To: <874oc6ze69.fsf@gmx.de> (Michael Albinus's message of "Thu, 28 Oct 2010 14:37:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) > ! ;; 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))) 2 problems with this patch: - (put 'permanent-local t) should *never* be in such a function. It's a top-level operation that has global effects and belongs right next to the var's defvar. - This makes it impossible to choose backup-by-copying-when-mismatch=nil when accessing such remote files, whereas for local files accessed by root a (setq backup-by-copying-when-mismatch nil) in the .emacs will do the trick. A simpler solution would be to change the default value of backup-by-copying-when-mismatch to t for everyone rather than just for root. I don't know what would the objections to this. Stefan From unknown Fri Jun 20 20:09:35 2025 X-Loop: help-debbugs@gnu.org Subject: bug#7289: Tramp changes ownership of remote file when saving Resent-From: Michael Albinus Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Nov 2010 07:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7289 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 7289@debbugs.gnu.org, Jo Vermeulen Received: via spool by 7289-submit@debbugs.gnu.org id=B7289.12885965312128 (code B ref 7289); Mon, 01 Nov 2010 07:29:01 +0000 Received: (at 7289) by debbugs.gnu.org; 1 Nov 2010 07:28:51 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PCop1-0000YH-Dq for submit@debbugs.gnu.org; Mon, 01 Nov 2010 03:28:51 -0400 Received: from mailout-de.gmx.net ([213.165.64.23] helo=mail.gmx.net) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1PCooy-0000YB-Tv for 7289@debbugs.gnu.org; Mon, 01 Nov 2010 03:28:50 -0400 Received: (qmail invoked by alias); 01 Nov 2010 07:33:06 -0000 Received: from p4FC19047.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [79.193.144.71] by mail.gmx.net (mp061) with SMTP; 01 Nov 2010 08:33:06 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+Sal99ORSS3jMsVnkRecRIjp+pW1zWJ/V7OxN6bo 6zJDYc+NHWOoB+ From: Michael Albinus References: <874oc6ze69.fsf@gmx.de> Date: Mon, 01 Nov 2010 08:33:02 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 31 Oct 2010 15:15:08 -0400") Message-ID: <87k4kxzefl.fsf@gmx.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Y-GMX-Trusted: 0 X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Stefan Monnier writes: > 2 problems with this patch: > - (put 'permanent-local t) should *never* be in such a function. > It's a top-level operation that has global effects and belongs right > next to the var's defvar. I want to have `backup-by-copying-when-mismatch' buffer local. If I set it in `insert-file-contents' (via `make-local-variable'), it is not kept buffer local in that buffer. How could I achieve this otherwise? > - This makes it impossible to choose backup-by-copying-when-mismatch=nil > when accessing such remote files, whereas for local files accessed by > root a (setq backup-by-copying-when-mismatch nil) in the .emacs will > do the trick. D'accord. We would need another way for the user to express his wish. Maybe there shall be also other values but only than nil and t. > A simpler solution would be to change the default value of > backup-by-copying-when-mismatch to t for everyone rather than just > for root. I don't know what would the objections to this. >From my pov it would be acceptable, but I don't know how people see it. And we should check what it does mean for remote files, because they tend to "mismatch" more often. > Stefan Best regards, Michael.