Subject: Tramp changes ownership of remote file when saving

From: Jo Vermeulen <[email-masked]>
Date: Wed, 27 Oct 2010 12:46:11 +0200

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 <backspace> <backspace> / u s r <tab> s h <tab>
e m <tab> a <tab> / <tab> <tab> 2 3 <tab> e <tab> p
r <backspace> <S-backspace> P R <tab> <return> C-x
o C-x o C-x o C-x 1 <down> <return> <right> <return>
<return> <up> <down> M-x d i r e <tab> - <tab> m <tab>
<backspace> <tab> <backspace> o <tab> d <tab> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> w d i r <tab> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> d i r e d - m <tab> <tab> <backspace>
<backspace> <backspace> <return> <return> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> C-s P R O B L E M <return>
<return> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <up> <up> <up> <up> <up> <down>
<end> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> C-s t r a m p C-s
<backspace> <backspace> <backspace> <backspace> <backspace>
<backspace> r e m o t e C-s C-s C-s s s <backspace>
<backspace> 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 <return> C-x k <return> M-x r e p o r t -
e m a c s <tab> <return>

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