Skip to content

remove the drop_corrupt_tail mechanism, refs #10369 - #10378

Open
mr-raj12 wants to merge 2 commits into
borgbackup:masterfrom
mr-raj12:remove-drop-corrupt-tail
Open

mr-raj12 wants to merge 2 commits into
borgbackup:masterfrom
mr-raj12:remove-drop-corrupt-tail

Conversation

@mr-raj12

Copy link
Copy Markdown
Contributor

Description

Follow-up to #10369, review point 3. Every check --repair rebuild of the chunk index now has an object validator, so drop_corrupt_tail was only reachable from tests.

Depends on #10369. This branch contains its commit; I will rebase onto master after #10369 is merged.

Changes

  • PackReader.iter_headers(): remove the drop_corrupt_tail parameter. Without a validator, a corrupt object header raises IntegrityError.
  • build_chunkindex_from_repo(): remove the drop_corrupt_tail parameter.
  • Repository: remove chunkindex_drop_corrupt_tail.
  • ArchiveChecker.check(): stop passing drop_corrupt_tail=repair and setting repository.chunkindex_drop_corrupt_tail.

No behaviour change: a walk without a validator only happens in a check without --repair, and it already raised.

Tests

  • Removed:
    • repository_test.py::test_pack_reader_drops_a_corrupt_tail_only_when_asked
    • repository_test.py::test_pack_reader_drops_a_corrupt_tail_without_an_on_drop
    • repository_test.py::test_pack_reader_drop_corrupt_tail_does_not_affect_a_validating_walk
    • cache_test.py::test_build_chunkindex_without_a_validator_drops_the_rest_of_a_damaged_pack
    • cache_test.py::test_build_chunkindex_without_drop_corrupt_tail_raises_on_a_damaged_pack
  • check_cmd_test.py::test_check_without_repair_does_not_drop_a_pack_tail renamed to test_check_without_key_aborts_on_a_corrupt_pack_header. It asserts that the rebuild gets no validator and raises CorruptPack.
  • Still covered by unchanged tests: test_pack_reader_raises_on_bad_magic (raises without a validator) and test_build_chunkindex_repair_resyncs_after_corrupt_header (CorruptPack without a validator; with one, the rebuild skips the damaged object and indexes the next one).

TZ=UTC pytest --benchmark-skip -n auto: 3072 passed, 1141 skipped.

Note for #10368

#10368 still passes drop_corrupt_tail=repair and sets chunkindex_drop_corrupt_tail in ArchiveChecker.check(). Whichever PR merges second removes those two lines.

Checklist

  • PR is against master (or maintenance branch if only applicable there)
  • New code has tests and docs where appropriate
  • Tests pass (run tox or the relevant test subset)
  • Commit messages are clean and reference related issues

…orgbackup#9901

Repair reads the key and aborts if it can not; objects that fail validation are not indexed and are reported as errors.
Every check --repair rebuild of the chunk index has an object validator
(borgbackup#10369), so drop_corrupt_tail was only reachable from tests.

- PackReader.iter_headers: remove the drop_corrupt_tail parameter. Without
  a validator, a corrupt object header raises IntegrityError.
- build_chunkindex_from_repo: remove the drop_corrupt_tail parameter.
- Repository: remove chunkindex_drop_corrupt_tail.
- ArchiveChecker.check: stop passing and setting drop_corrupt_tail.
- tests: remove the 5 tests for drop_corrupt_tail, rewrite
  test_check_without_repair_does_not_drop_a_pack_tail as
  test_check_without_key_aborts_on_a_corrupt_pack_header.
@codecov

codecov Bot commented Sep 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.11%. Comparing base (3b905e0) to head (624ccdc).
⚠️ Report is 35 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10378      +/-   ##
==========================================
- Coverage   88.12%   88.11%   -0.02%     
==========================================
  Files         103      103              
  Lines       18928    18843      -85     
  Branches     2923     2911      -12     
==========================================
- Hits        16681    16604      -77     
+ Misses       1556     1554       -2     
+ Partials      691      685       -6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant