GNU bug report logs - #64821
30.0.50; write-region errs when overwriting an already open file

Previous Next

Package: emacs;

Reported by: Ihor Radchenko <yantar92 <at> posteo.net>

Date: Mon, 24 Jul 2023 07:13:02 UTC

Severity: normal

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64821 <at> debbugs.gnu.org, yantar92 <at> gmail.com
Subject: bug#64821: 30.0.50; write-region errs when overwriting an already open file
Date: Thu, 27 Jul 2023 19:47:46 +0200
27 juli 2023 kl. 18.31 skrev Eli Zaretskii <eliz <at> gnu.org>:

> Is that this line:
> 
>          (with-current-buffer (get-file-buffer (file-truename filename))
>            (set-visited-file-modtime))

Right, and it's probably because ERT creates temporary files in /var/something but on macOS, /var is a symlink to /private/var. In the lines above, filename (and file-truename) is the "/private/var/..." version.
Thus get-file-buffer won't return anything because buffer-file-name contains the non-true name, "/var/...".

I have no idea if this is the right solution (probably not) but it makes filelock-tests all pass:

--- a/test/src/filelock-tests.el
+++ b/test/src/filelock-tests.el
@@ -38,8 +38,8 @@ filelock-tests--fixture
 Finally, delete the buffer and the test directory."
   (declare (debug (body)))
   `(ert-with-temp-directory temp-dir
-     (let ((name (concat (file-name-as-directory temp-dir)
-                         "userfile"))
+     (let ((name (file-truename (concat (file-name-as-directory temp-dir)
+                                        "userfile")))
            (create-lockfiles t))
        (with-temp-buffer
          (setq buffer-file-name name





This bug report was last modified 1 year and 299 days ago.

Previous Next


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