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.

Full log


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.







This bug report was last modified 3 years and 45 days ago.

Previous Next


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