all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>,
	Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 60146@debbugs.gnu.org
Subject: bug#60146: file-exists-in-trash-p needs better name or semantics
Date: Sat, 17 Dec 2022 10:47:45 +0200	[thread overview]
Message-ID: <83a63mifgu.fsf@gnu.org> (raw)
In-Reply-To: <d0203c75-4499-8d23-7acd-fde36d47b718@cs.ucla.edu> (message from Paul Eggert on Fri, 16 Dec 2022 21:17:13 -0800)

> Date: Fri, 16 Dec 2022 21:17:13 -0800
> From: Paul Eggert <eggert@cs.ucla.edu>
> 
> 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.

I don't really mind renaming that function, but the reason I called it
like I did was that apparently no one needed such a functionality in
Emacs until now, except in this obscure use case of moving to trash.
That seems to tell me that extending file-exists-p would be a solution
waiting for the problem, something that we don't like doing.

In any case, if we do decide to extend file-exists-p, it would need to
be done on master, as that is not a trivial change, which has to be
done in C.

Lars, Stefan, WDYT?





  reply	other threads:[~2022-12-17  8:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83a63mifgu.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=60146@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.