Repository navigation
check: delete corrupt packs where nothing authenticates if other objects authenticate, fixes #10479 - #10643
Open
akasakariko wants to merge 1 commit into
Conversation
…cts authenticate, fixes borgbackup#10479 When no object in a corrupt pack authenticates during borg check --repair, Repository.salvage_pack previously left the pack in place before performing the second store load, leaving borg check and borg compact failing on single-object packs such as damaged archive metadata packs Changes: - Always perform the second store.load() in Repository.salvage_pack before checking whether any object authenticated, so differing reads return SALVAGE_READS_DIFFER even when zero objects authenticate - Add delete_if_empty (bool or callable, default False) to Repository.salvage_pack so a pack with zero authenticating objects is deleted (with new_pack_id=None, before_old_pack_delete called, and its index entries removed) when allowed - In Repository._salvage_corrupt_packs, allow deleting such packs only once another object has passed validate and authenticate in the same run (from another salvaged pack, an intact pack probed via _authenticate_any_object, or a pack that re-read intact), deferring empty-salvage packs when no intact pack exists so the result is independent of pack order while preserving the guard against a broken authenticator or wrong key - Update help texts, docs, and tests Fixes borgbackup#10479 Refs borgbackup#10026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #10479
Refs #10026
Previously, when no object in a corrupt pack authenticated during
borg check --repair,Repository.salvage_packreturnedSALVAGE_NOTHING_AUTHENTICATESbefore doing the secondstore.load()and left the pack in place, causing subsequentborg checkandborg compactruns to keep failing unlessborg check --repair --verify-datawas runThis changes pack salvage to treat a corrupt pack in which no object authenticates like a zero-kept-objects salvage (deleting the pack and removing its chunk index entries, reported as a lossy salvage) only when both conditions hold:
store.load()returns the same bytes (checked before deciding onSALVAGE_NOTHING_AUTHENTICATES, so differing reads returnSALVAGE_READS_DIFFER)validateandauthenticatein the same run (either from another salvaged pack, from probing intact packs viaRepository._authenticate_any_object, or from a pack that re-read intact), deferring empty corrupt packs if needed so the outcome does not depend on pack order while still leaving packs untouched on a broken validator/authenticator, wrong key, or single-pack repositoryDocs and command help texts (
check,compact,repo-compress,docs/internals/packs.rst,docs/faq.rst) and tests insrc/borg/testsuite/repository_test.pyandsrc/borg/testsuite/archiver/check_cmd_test.pyare updated accordinglyChecklist
master(or maintenance branch if only applicable there)toxor the relevant test subset)