tramp-devel
[Top][All Lists]
Advanced

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

Re: Curious permission problem


From: Ole Laursen
Subject: Re: Curious permission problem
Date: Thu, 18 Feb 2010 12:45:19 +0100

On Thu, Feb 18, 2010 at 11:15 AM, Michael Albinus
<address@hidden> wrote:
> The permission setting is not triggered by Tramp, when it copies the
> local temporary file. It comes from `basic-save-buffer-2', which calls
> `set-file-modes' with the original file permissions (and then Tramp is
> called, again).

I think we're misunderstanding each other somehow. As I mentioned, I
don't understand what happens, but if you say that Tramp has no say in
this, then how come I can fix the problem by overriding
tramp-default-file-modes? Maybe Tramp's not triggering the call, but
it seems to me that Tramp is telling Emacs what mode to use.

Here's an "strace -o log emacs -q" with default Tramp (I have Emacs
23.1.1) with the commands touching the temporary file grepped out (I'm
just opening the file here, not trying to save it):

stat64("/tmp/tramp.247472RS", 0xbf972f08) = -1 ENOENT (No such file or
directory)
stat64("/tmp/tramp.24747sYQ", 0xbf95ffc8) = -1 ENOENT (No such file or
directory)
lstat64("/tmp/.#tramp.24747sYQ", 0xbf95fc30) = -1 ENOENT (No such file
or directory)
symlink("address@hidden:1266490023", "/tmp/.#tramp.24747sYQ") = 0
open("/tmp/tramp.24747sYQ",
O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0666) = 6
stat64("/tmp/tramp.24747sYQ", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
lstat64("/tmp/.#tramp.24747sYQ", {st_mode=S_IFLNK|0777, st_size=26, ...}) = 0
readlink("/tmp/.#tramp.24747sYQ", "address@hidden:1266490023"..., 100) = 26
unlink("/tmp/.#tramp.24747sYQ")         = 0
lstat64("/tmp/.#tramp.24747sYQ", 0xbf95ffb0) = -1 ENOENT (No such file
or directory)
symlink("address@hidden:1266490023", "/tmp/.#tramp.24747sYQ") = 0
open("/tmp/tramp.24747sYQ", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 6
stat64("/tmp/tramp.24747sYQ", {st_mode=S_IFREG|0600, st_size=17, ...}) = 0
lstat64("/tmp/.#tramp.24747sYQ", {st_mode=S_IFLNK|0777, st_size=26, ...}) = 0
readlink("/tmp/.#tramp.24747sYQ", "address@hidden:1266490023", 100) = 26
unlink("/tmp/.#tramp.24747sYQ")         = 0
chmod("/tmp/tramp.24747sYQ", 064)       = 0
stat64("/tmp/tramp.24747sYQ", {st_mode=S_IFREG|064, st_size=17, ...}) = 0
open("/tmp/tramp.24747sYQ", O_RDONLY|O_LARGEFILE) = -1 EACCES
(Permission denied)
stat64("/tmp/tramp.24747sYQ", {st_mode=S_IFREG|064, st_size=17, ...}) = 0
unlink("/tmp/tramp.24747sYQ")           = 0

And here's a similar one where I override tramp-default-file-modes to
return 0600 - the only difference is the chmod syscall which is now
600, and then the following read doesn't return permission denied:

stat64("/tmp/tramp.6893gYS", 0xbf9d7878) = -1 ENOENT (No such file or directory)
stat64("/tmp/tramp.6893WfQ", 0xbf9c4938) = -1 ENOENT (No such file or directory)
lstat64("/tmp/.#tramp.6893WfQ", 0xbf9c45a0) = -1 ENOENT (No such file
or directory)
symlink("address@hidden:1266490023", "/tmp/.#tramp.6893WfQ") = 0
open("/tmp/tramp.6893WfQ",
O_WRONLY|O_CREAT|O_EXCL|O_TRUNC|O_LARGEFILE, 0666) = 6
stat64("/tmp/tramp.6893WfQ", {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
lstat64("/tmp/.#tramp.6893WfQ", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
readlink("/tmp/.#tramp.6893WfQ", "address@hidden:1266490023", 100) = 25
unlink("/tmp/.#tramp.6893WfQ")          = 0
lstat64("/tmp/.#tramp.6893WfQ", 0xbf9c4920) = -1 ENOENT (No such file
or directory)
symlink("address@hidden:1266490023", "/tmp/.#tramp.6893WfQ") = 0
open("/tmp/tramp.6893WfQ", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 6
stat64("/tmp/tramp.6893WfQ", {st_mode=S_IFREG|0600, st_size=17, ...}) = 0
lstat64("/tmp/.#tramp.6893WfQ", {st_mode=S_IFLNK|0777, st_size=25, ...}) = 0
readlink("/tmp/.#tramp.6893WfQ", "address@hidden:1266490023"..., 100) = 25
unlink("/tmp/.#tramp.6893WfQ")          = 0
chmod("/tmp/tramp.6893WfQ", 0600)       = 0
stat64("/tmp/tramp.6893WfQ", {st_mode=S_IFREG|0600, st_size=17, ...}) = 0
open("/tmp/tramp.6893WfQ", O_RDONLY|O_LARGEFILE) = 6
stat64("/tmp/tramp.6893WfQ", {st_mode=S_IFREG|0600, st_size=17, ...}) = 0
unlink("/tmp/tramp.6893WfQ")            = 0


> Tramp's behaviour is consistent with the local file case. Assumed, you
> have a local file with "---xrwxr--" permissions, owned by root. You can
> open it, but when you try to save modifications, you get a similar error
> by Emacs.

I just tested this, and this is not in agreement with what I'm
experiencing. Execute these commands on a local system

echo foo > bar
sudo chown root bar
sudo chmod u-rw bar
sudo chmod g+rw bar

Then open "bar" with Emacs, modify it and save. This works fine for me.

-- 
Ole Laursen
http://www.iola.dk/




reply via email to

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