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

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

bug#64821: 30.0.50; write-region errs when overwriting an already open f


From: Mattias Engdegård
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@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






reply via email to

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