GNU bug report logs - #41414
28.0.50; `find-file-noselect' + `file-truename' gotcha

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Wed, 20 May 2020 00:35:02 UTC

Severity: minor

Found in version 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41414 in the body.
You can then email your comments to 41414 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#41414; Package emacs. (Wed, 20 May 2020 00:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 20 May 2020 00:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; `find-file-noselect' + `file-truename' gotcha
Date: Wed, 20 May 2020 02:34:43 +0200
Hello,

`find-file-noselect' tries to reuse buffers already visiting the file
under a different name, e.g. via a symlink, but it doesn't check if that
name is still valid (which is not the case when the symlink has been
deleted after the file has been visited using this name).  The behavior
makes it hard to visit the file under its valid name because Emacs
tries to revert the existing buffer which fails.

Here is a recipe, I start with a directory like this:

  /home/micha/Treasure/today/test:
  total used in directory 29 available 123.8 GiB
  drwxrwxr-x  2 micha micha     4k 05-20 02:20 .
  drwxr-xr-x 69 micha micha    24k 05-20 02:19 ..
  -rw-rw-r--  1 micha micha      5 05-20 02:20 a
S lrwxrwxrwx  1 micha micha      1 05-20 02:21 b -> a

I visit b (I did that from dired), then, without killing the b visiting
buffer, I delete the b -> a symlink, then I try to visit "a" and get:

Debugger entered--Lisp error: (error "File /home/micha/today/test/b no longer exists!")
  signal(error ("File /home/micha/today/test/b no longer exists!"))
  error("File %s no longer exists!" "/home/micha/today/test/b")
  revert-buffer-insert-file-contents--default-function("/home/micha/today/test/b" nil)
  revert-buffer--default(t t)
  revert-buffer(t t)
  find-file-noselect("/home/micha/today/test/a")
  view-file("/home/micha/today/test/a")
  dired-view-file()
  funcall-interactively(dired-view-file)
  call-interactively(dired-view-file nil nil)
  command-execute(dired-view-file)

Depending on `revert-without-query' you are asked whether to revert the
"b" buffer.  That will fail.  That "b" buffer should better be ignored
by Emacs to avoid confusion.

Thanks,

Michael.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#41414; Package emacs. (Mon, 06 Jun 2022 13:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 41414 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 41414 <at> debbugs.gnu.org
Subject: Re: bug#41414: 28.0.50; `find-file-noselect' + `file-truename' gotcha
Date: Mon, 06 Jun 2022 15:50:49 +0200
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> Here is a recipe, I start with a directory like this:
>
>   /home/micha/Treasure/today/test:
>   total used in directory 29 available 123.8 GiB
>   drwxrwxr-x  2 micha micha     4k 05-20 02:20 .
>   drwxr-xr-x 69 micha micha    24k 05-20 02:19 ..
>   -rw-rw-r--  1 micha micha      5 05-20 02:20 a
> S lrwxrwxrwx  1 micha micha      1 05-20 02:21 b -> a
>
> I visit b (I did that from dired), then, without killing the b visiting
> buffer, I delete the b -> a symlink, then I try to visit "a" and get:
>
> Debugger entered--Lisp error: (error "File /home/micha/today/test/b no
> longer exists!")
>   signal(error ("File /home/micha/today/test/b no longer exists!"))
>   error("File %s no longer exists!" "/home/micha/today/test/b")

This no longer happens in Emacs 29, but the subsequent problems are
still present.  That is, trying to revert the buffer etc will lead to
errors.

So I've now changed find-file-noselect to ignore buffers with file names
that no longer exist in Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 41414 <at> debbugs.gnu.org and Michael Heerdegen <michael_heerdegen <at> web.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 06 Jun 2022 13:52:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 05 Jul 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 1 day ago.

Previous Next


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