Kai Gro�johann wrote:

> Glenn Morris <[EMAIL PROTECTED]> writes:
>
>> (setq backup-directory-alist '(("^/su:root.*" . "/root/.emacs.d/backups")
>>                                ("." . "/home/gmorris/.emacs.d/backups")))
>
> Stupid question: does it work if you use
> "/su:[EMAIL PROTECTED]:/root/.emacs.d/backups" instead of
> "/root/.emacs.d/backups"?

Not a stupid question at all, given that, yes, that works! Thank you.

> It would be nice if Emacs just did what you meant, but I'm afraid
> that is a little difficult. Do you have any idea, conceptually, how
> to achieve the right behavior?

I think it's fair that if I tell Emacs to put all backup files in one
directory, it does so, regardless of the original files being on a
different machine or having a different owner. But the changing
ownership of the backup files confuses me.

By this, I mean in the case in which I use the su:[EMAIL PROTECTED]
method to edit a file on the local machine. If backup-directory-alist
is nil, the resulting backup file ends up owned by root, with the same
permissions as the original file. If backup-directory-alist causes the
backup file to be relocated to an absolute directory, then the backup
file ends up being owned by the user that invoked Emacs (unless I use
your solution from above). This seems inconsistent to me, and is not
what I would expect to happen. It's also potentially dangerous if the
files should be owned by root.

But I can see that it's difficult to know what to do. The user on the
remote machine might not even exist on the local machine. Or one could
be su'ing to a user without permission to write to the backup
directory.

Maybe Tramp should temporarily set backup-directory-alist to nil at
the appropriate point for a Tramp file?

Or maybe there should just be a comment in the Tramp manual that people
using backup-directory-alist should bear in mind that there might be
some effects, and they might need to adapt the value accordingly?



_______________________________________________
Tramp-devel mailing list
[EMAIL PROTECTED]
http://mail.nongnu.org/mailman/listinfo/tramp-devel

Reply via email to