check if object is modified before starting to send it
authorJoey Hess <joeyh@joeyh.name>
Mon, 26 Jul 2021 21:33:49 +0000 (17:33 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 26 Jul 2021 21:33:49 +0000 (17:33 -0400)
commit3b5a3e168d8decd196509ad582ad4b8795d979a6
treeacdcfde15036e4d10f38fa27b84391a088bca990
parentae015c2ab95d7e195b92f670f529c830a547f0ca
check if object is modified before starting to send it

Fix bug that caused some transfers to incorrectly fail with "content
changed while it was being sent", when the content was not changed.

While I don't know how to reproduce the problem that several people
reported, it is presumably due to the inode cache somehow being stale.
So check isUnmodified', and if it's not modified, include the file's
current inode cache in the set to accept, when checking for modification
after the transfer.

That seems like the right thing to do for another reason: The failure
says the file changed while it was being sent, but if the object file was
changed before the transfer started, that's wrong. So it needs to check
before allowing the transfer at all if the file is modified.

(Other calls to sameInodeCache or elemInodeCaches, when operating on inode
caches from the database, could also be problimatic if the inode cache is
somehow getting stale. This does not address such problems.)

Sponsored-by: Dartmouth College's Datalad project
Annex/Content.hs
Annex/Content/Presence.hs
CHANGELOG
doc/bugs/__34__failed_to_send_content_to_remote__34__/comment_19_9a1c92462a5393155298d70ef90d3019._comment [new file with mode: 0644]