unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattias.engdegard@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 64821@debbugs.gnu.org, yantar92@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	[thread overview]
Message-ID: <4F213DB7-96C1-48F2-AE87-F22136C0848E@gmail.com> (raw)
In-Reply-To: <83mszhl3j1.fsf@gnu.org>

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	other threads:[~2023-07-27 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-24  7:12 bug#64821: 30.0.50; write-region errs when overwriting an already open file Ihor Radchenko
2023-07-24 15:11 ` Eli Zaretskii
2023-07-25  8:16   ` Ihor Radchenko
2023-07-25 12:19     ` Eli Zaretskii
2023-07-27 15:07 ` Mattias Engdegård
2023-07-27 16:31   ` Eli Zaretskii
2023-07-27 17:47     ` Mattias Engdegård [this message]
2023-07-27 19:02       ` Eli Zaretskii
2023-07-27 19:49         ` Mattias Engdegård
2023-07-28  6:40           ` Eli Zaretskii
2023-07-28  9:01             ` Mattias Engdegård
2023-07-28 12:08               ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4F213DB7-96C1-48F2-AE87-F22136C0848E@gmail.com \
    --to=mattias.engdegard@gmail.com \
    --cc=64821@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=yantar92@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).