bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Paul Eggert
Subject: bug#60146: file-exists-in-trash-p needs better name or semantics
Date: Fri, 16 Dec 2022 21:17:13 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

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.






reply via email to

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