GNU bug report logs - #60146
file-exists-in-trash-p needs better name or semantics

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sat, 17 Dec 2022 05:18:01 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#60146: closed (file-exists-in-trash-p needs better name or
 semantics)
Date: Sat, 17 Dec 2022 23:56:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 17 Dec 2022 15:55:43 -0800
with message-id <08f9aafc-34a4-de76-df7c-fb28d9bbc607 <at> cs.ucla.edu>
and subject line Re: bug#60146: file-exists-in-trash-p needs better name or semantics
has caused the debbugs.gnu.org bug report #60146,
regarding file-exists-in-trash-p needs better name or semantics
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
60146: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60146
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: file-exists-in-trash-p needs better name or semantics
Date: Fri, 16 Dec 2022 21:17:13 -0800
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.



[Message part 3 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: larsi <at> gnus.org, monnier <at> iro.umontreal.ca, 60146-done <at> debbugs.gnu.org
Subject: Re: bug#60146: file-exists-in-trash-p needs better name or semantics
Date: Sat, 17 Dec 2022 15:55:43 -0800
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.



This bug report was last modified 2 years and 210 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.