emacs-devel
[Top][All Lists]
Advanced

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

Re: file-equal-p


From: tomas
Subject: Re: file-equal-p
Date: Fri, 17 Feb 2023 13:45:57 +0100

On Fri, Feb 17, 2023 at 02:25:38PM +0200, Eli Zaretskii wrote:
> > From: Andreas Schwab <schwab@linux-m68k.org>
> > Cc: Po Lu <luangruo@yahoo.com>,  emacs-devel@gnu.org
> > Date: Fri, 17 Feb 2023 11:02:48 +0100
> > 
> > On Feb 16 2023, Richard Stallman wrote:
> > 
> > > If so, can Emacs examine it using that other way?
> > 
> > The right way to solve the issue is to only compare the inode and device
> > numbers.  The other attributes (other than the type) can change any time
> > for unrelated reasons, and do not define the identity of a file.
> 
> That depends on the semantics of "files are equal".  If the issue is
> only whether two file names point to the same file's data, then yes,
> using file-attribute-file-identifier is TRT.

This is how I read `file-equal-p''s docstring [1] (coming from Lisp,
I'd called it `file-eq-p', but hey :-)

>                                              But that is not the only
> possible semantics of these tests.  It is therefore up to the
> application to decide which API to use, IMO.
> 
> Of course, as long as the file is identified only by its name, race
> condition is possible even if we only compare the inode and the device
> number.

Identity is always difficult in a mutable world, yes.

Cheers

[1] Return non-nil if files FILE1 and FILE2 name the same file.
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

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