GNU bug report logs - #18336
24.4.50; When editing externally changed file, Emacs asks too many questions

Previous Next

Package: emacs;

Reported by: David Kastrup <dak <at> gnu.org>

Date: Wed, 27 Aug 2014 08:19:01 UTC

Severity: minor

Tags: fixed, patch

Found in version 24.4.50

Fixed in version 28.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: dak <at> gnu.org, stefan <at> marxist.se, 18336 <at> debbugs.gnu.org
Subject: bug#18336: 24.4.50; When editing externally changed file, Emacs asks too many questions
Date: Thu, 05 Mar 2020 09:13:32 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > and my /tmp file system where I also saw this is

>> I ran my initial experiment in ~/tmp,[...]
>> When I do the same on /tmp, which is mounted noatime I see the extra
>> "<file> changed on disk; really edit the buffer?" question on C-x C-s.

> lock_file calls verify-visited-file-modtime, which might be affected
> by the noatime option.  But I don't understand how noatime could
> affect verify-visited-file-modtime since the latter looks at mtime,
> not atime.

> Can someone who sees this step with GDB through lock_file and its
> callees, and see what goes wrong there and why?

Ah, looks like the noatime thing is just a coincidence.  What happens in
the ~/tmp case is that when lock_file is called from write_region, the
file doesn't exist, so the extra "changed on disk" question doesn't get
asked.  The reason the file doesn't exist, is because it was moved to
the backup name, in backup-buffer.  Files under /tmp/ are not backed up
by default, so in that case the file still exists and there is an extra
query.

    lock_file (Lisp_Object fn)
    {
      [...]
        if (!NILP (subject_buf)
        && NILP (Fverify_visited_file_modtime (subject_buf))
        && !NILP (Ffile_exists_p (fn)))
          call1 (intern ("userlock--ask-user-about-supersession-threat"), fn);

    (defun backup-buffer ()
      [...]
                  (rename-file real-file-name backupname t)

If I do (setq backup-enable-predicate #'ignore), i.e., disable backup,
then I get the extra query for ~/tmp/foo as well.  The OP mentions
version control, that also affects this because of the
vc-make-backup-files option (defaulting to nil, i.e., backup doesn't
happen for files under vc).




This bug report was last modified 5 years and 120 days ago.

Previous Next


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