unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#60146: file-exists-in-trash-p needs better name or semantics
@ 2022-12-17  5:17 Paul Eggert
  2022-12-17  8:47 ` Eli Zaretskii
  2022-12-17 10:01 ` Michael Albinus
  0 siblings, 2 replies; 8+ messages in thread
From: Paul Eggert @ 2022-12-17  5:17 UTC (permalink / raw)
  To: 60146

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.






^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-12-17 23:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-17  5:17 bug#60146: file-exists-in-trash-p needs better name or semantics Paul Eggert
2022-12-17  8:47 ` Eli Zaretskii
2022-12-17 15:51   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-17 17:45     ` Eli Zaretskii
2022-12-17 19:57   ` Paul Eggert
2022-12-17 20:09     ` Eli Zaretskii
2022-12-17 23:55       ` Paul Eggert
2022-12-17 10:01 ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).