[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Finding buffers visiting TRAMP sudo files
From: |
Michael Albinus |
Subject: |
Re: Finding buffers visiting TRAMP sudo files |
Date: |
Fri, 27 Oct 2017 14:09:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) |
"Basil L. Contovounesios" <address@hidden> writes:
Hi Basil,
>> Maybe one could argue that the inode number shall equal
>> for both files, but the device numbers must differ.
>
> Hmm, for me on GNU/Linux the device numbers are indeed
> different but the inode number is always the same:
>
> (equal (file-attribute-inode-number
> (file-attributes "/etc/pam.conf"))
> (file-attribute-inode-number
> (file-attributes "/sudo::/etc/pam.conf")))
> ⇒ t
>
> (equal (file-attribute-device-number
> (file-attributes "/etc/pam.conf"))
> (file-attribute-device-number
> (file-attributes "/sudo::/etc/pam.conf")))
> ⇒ nil
>
> Is there anything unusual about this?
That's as expected. However, on remote hosts which do not tell us inode
numbers, Tramp generates virtual ones. Think about "smb", for example.
> By "comparing" e.g. "/etc/pam.conf" and
> "/sudo::/etc/pam.conf" I mean determining whether they
> ultimately name the same file, as per file-equal-p.
Tramp has no information about how different methods and hosts are
related. Even "/ssh::.emacs" and "/scp::.emacs" live on different
filesystems for Tramp.
One could implement such a relation for local files and remote files on
the local host, using Tramp's `tramp-local-host-p' function. This would
require an extension to Tramp's implementation of `file-equal-p'.
Hmm, I'm kind of undecided whether it's worth to do.
> Kind regards,
Best regards, Michael.