make repair interruption safe

Fixed bug that interrupting git-annex repair (or assistant) while it was
fixing repository corruption would lose objects that were contained in pack
files.

Unpack all pack files and move objects into place *before* deleting the
pack files. The old approach moved the pack files to a temp directory
before unpacking them, which was not interruption safe.

Sponsored-By: Jochen Bartl on Patreon
This commit is contained in:
Joey Hess 2021-06-29 12:57:19 -04:00
parent a492553eca
commit 199391befe
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 48 additions and 16 deletions

View file

@ -0,0 +1,19 @@
[[!comment format=mdwn
username="joey"
subject="""comment 16"""
date="2021-06-29T16:11:03Z"
content="""
I have verified that an interrupted repair results in data loss, when
.git/objects contains pack files.
Fixed that. Which leaves 2 open questions:
* Was the assistant interrupted somehow while it was running repair, in
Atemu's case? That could have been anything from the laptop being
powered off, to it being stopped explicitly, to it crashing.
* What caused the assistant to think it needed repair in the first place?
Although the answer to the second question doesn't matter much if the
data loss bug is fixed -- if there's a problem of some kind causing
unncessary repairs, it would only be some excess CPU load.
"""]]