tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Ownership change on save.


From: Russell Sim
Subject: Ownership change on save.
Date: Thu, 05 Jul 2012 07:50:24 +1000
User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.1.50 (gnu/linux)

Hi,

At the moment when I save a remote file it always seems to change the
file permissions to the user I am accessing it as.  For example if I am
editing a file as root and the file is owned by a user, on save the file
will be owned as root.  At first I thought this was a config error and I
but I was able to reproduce it using emacs23 emacs24 and emacs24.1.50.1
with -Q.

The problem is file-attrs are being stored as floats so when it comes to
deciding if the ownership needs to be changed the eq comparison fails.
I have included a patch that changes these tests to eql operations which
support floating point number comparisons.

I also did some digging about the tramp-compat-file-attributes function
which is the source of the attribute data.  It seems that the function
file-attributes can will return floats or integers, even if the
id-format is set to integer.

Thanks,
Russell


diff -c -L /home/russell/tramp-sh.el -L \#\<buffer\ tramp-sh.el\> 
/home/russell/tramp-sh.el /tmp/buffer-content-11983s8z
*** /home/russell/tramp-sh.el
--- #<buffer tramp-sh.el>
***************
*** 3290,3297 ****
               ;; be different from (buffer-file-name), f.e. if
               ;; `file-precious-flag' is set.
               (nth 5 file-attr))
!             (when (and (eq (nth 2 file-attr) uid)
!                        (eq (nth 3 file-attr) gid))
                (setq need-chown nil))))
  
        ;; Set the ownership.
--- 3290,3297 ----
               ;; be different from (buffer-file-name), f.e. if
               ;; `file-precious-flag' is set.
               (nth 5 file-attr))
!             (when (and (eql (nth 2 file-attr) uid)
!                        (eql (nth 3 file-attr) gid))
                (setq need-chown nil))))
  
        ;; Set the ownership.

Diff finished.  Thu Jul  5 07:26:13 2012




reply via email to

[Prev in Thread] Current Thread [Next in Thread]