Subject: bug#60146: closed (Re: bug#60146: file-exists-in-trash-p needs better name or semantics)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 17 Dec 2022 23:56:02 +0000

Your bug report

#60146: file-exists-in-trash-p needs better name or semantics

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
60146: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60146
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#60146: file-exists-in-trash-p needs better name or semantics
From: Paul Eggert <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked], [email-masked]
Date: Sat, 17 Dec 2022 15:55:43 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On 12/17/22 12:09, Eli Zaretskii wrote:
> If you can verify that it works in the scenario of bug#59986, I'm okay
> with this change.

Thanks, I checked that the patch works in that scenario (dangling 
symlink in the trash directory), and installed it. Closing the bug report.

Subject: file-exists-in-trash-p needs better name or semantics
From: Paul Eggert <[email-masked]>
To: [email-masked]
Date: Fri, 16 Dec 2022 21:17:13 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

The recently-added function (file-exists-in-trash-p FILE) is poorly 
named since it's not really related to trash - it's simply checking for 
the existence of a directory entry named FILE.

How about extending file-exists-p instead? (file-exists-p FILE t) would 
be like (file-exists-p FILE) except it would not follow symlinks. This 
extension can be implemented via a single system call on POSIX systems, 
and this would be more efficient and would avoid a race in the current 
implementation of file-exists-in-trash-p. (Though of course pretty much 
any use of this new function makes one vulnerable to races....)

If extending file-exists-p is too much, at least please rename 
file-exists-in-trash-p to something like files--exists-nofollow-p, to 
indicate that it's private to files.el and to say better what it means.