tramp-devel
[Top][All Lists]
Advanced

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

Re: problem with preserving emacs tramp file permissions


From: Michael Albinus
Subject: Re: problem with preserving emacs tramp file permissions
Date: Wed, 05 Sep 2012 09:10:03 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

Konstantin Weiner <address@hidden> writes:

> Hi Michael!

Hi Konstantin,

> Attached is a small snippet of *debug tramp/pscp
> I am not sure if this is sensitive, so I sent it offlist.

I've cc'ed address@hidden, the code snippets we're speaking about
are harmless.

A full debug trace would be more useful, some events I must assume now.

> This is just one edit + save that results in a wrong chmod.
>
> I see at 08:58:38.875000
> there is a chmod 0666
> whereas it should have been 0777.

Yes. Let's check the relevant commands (always with level (6)).

> 08:58:25.437000 tramp-send-command (6) # ( (test -e 
> /var/lib/asterisk/agi-bin/mp/IVRGWCharge.php || test -h 
> /var/lib/asterisk/agi-bin/mp/IVRGWCharge.php) && \stat -c '(("%N") %h %u %g 
> %Xe0 %Ye0 %Ze0 %se0 "%A" t %ie0 -1)' 
> /var/lib/asterisk/agi-bin/mp/IVRGWCharge.php || echo nil) 2>/dev/null; echo 
> tramp_exit_status $?
> 08:58:25.656000 tramp-wait-for-regexp (6) #
> (("`/var/lib/asterisk/agi-bin/mp/IVRGWCharge.php'") 1 0 0 1346824336e0 
> 1346824538e0 1346824709e0 19953e0 "-rwxrwxrwx" t 3934046e0 -1)
> tramp_exit_status 0
> ///f594fb7538fc60de21a3889544563e9b#$

You edit the file /var/lib/asterisk/agi-bin/mp/IVRGWCharge.php on the
remote server. It has permissions 0777 aka "-rwxrwxrwx".

> 08:58:35.062000 tramp-do-copy-or-rename-file-out-of-band (6) # pscp -scp -q 
> -r c:/temp/tmp/tramp.15028IRl.php 
> address@hidden:/var/lib/asterisk/agi-bin/mp/IVRGWCharge.php

Tramp copies your local temporary copy of that file to the remote
server. This local file is what you have edited and saved in reality,
behind the scenes.

> 08:58:38.875000 tramp-send-command (6) # chmod 0666 
> /var/lib/asterisk/agi-bin/mp/IVRGWCharge.php 2>/dev/null; echo 
> tramp_exit_status $?
> 08:58:39.078000 tramp-wait-for-regexp (6) #
> tramp_exit_status 0
> ///f594fb7538fc60de21a3889544563e9b#$

And now, Tramp changes the permissions to 0666, yes. This is likely,
because your local copy c:/temp/tmp/tramp.15028IRl.php has 0666
permissions.

When you have started to edit that remote file, Tramp has created the
local copy of that file. Usually, it should have the same permissions as
the original, remote file. Tramp uses the following function to
determine the permissions of the remote file:

(defun tramp-default-file-modes (filename)
  "Return file modes of FILENAME as integer.
If the file modes of FILENAME cannot be determined, return the
value of `default-file-modes', without execute permissions."
  (or (file-modes filename)
      (logand (default-file-modes) (tramp-compat-octal-to-decimal "0666"))))

That means, if for any reason the permissions of the remote file cannot
be determined, it will be 0666 as seen.

Another possibility is, that your local machine (running MS Windows)
does not handle file permissions properly. This I cannot check; usually
I'm not running Microsoft software.

With a full trace it might be possible to check what happened.

> Thanks for your help!

Best regards, Michael.



reply via email to

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