Subject: bug#35497: [PATCH] Don't rewrite buffer contents after saving by rename

From: Michael Albinus <[email-masked]>
Date: Tue, 30 Apr 2019 23:21:26 +0200

Jonathan Tomer <[email-masked]> writes:

Hi Jonathan,

> I thought about checking that the inode number changes, but that
> wouldn't have caught this particular bug (where the file is renamed
> into place with the correct contents, and then rewritten in place
> again); indeed, that doesn't appear to be easily caught with any
> examination of the final state alone, since what we're looking for is
> to prove the *absence* of any write that fails to change the inode
> number. (Perhaps we could check that the modification time of the
> file, after write, is *less* than its inode change time, proving that
> there has been no ordinary write since the rename -- but in my
> experience, inode timestamps are not actually more reliable than
> inotify, and in particular this check is easily defeated by the
> mode-setting that happens after the write is complete, requiring care
> to make sure that save-buffer will not attempt to do so.)

I see. But pls keep in mind, that inotify is not the only file
notification backend. Currently, we have six different beasts for this.

> Best,
> Jonathan

Best regards, Michael.