Subject: Re: bug#18336: 24.4.50; When editing externally changed file, Emacs asks too many questions

From: Eli Zaretskii <[email-masked]>
Date: Mon, 02 Mar 2020 18:33:05 +0200

> From: Noam Postavsky <[email-masked]>
> Cc: Stefan Kangas <[email-masked]>,  Eli Zaretskii <[email-masked]>,  [email-masked]
> Date: Mon, 02 Mar 2020 07:20:04 -0500
> 
> > and my /tmp file system where I also saw this is
> >
> > /dev/sda5 on / type ext4 (rw,noatime,discard)
> 
> Aha, this seems to be the key.  I ran my initial experiment in ~/tmp,
> which is mounted with relatime
> 
>     /dev/sda9 on /home type ext4 (rw,relatime,data=ordered)
> 
> 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.
> 
>     /dev/sda8 on /tmp type ext4 (rw,noatime,data=ordered)

This seems to point to the call to lock_file we make in write_region
(which is called to save the buffer).  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.

Or maybe the time is not the issue here, and the problem is with the
check of the file's size that verify-visited-file-modtime performs?

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