Skip to content

check: treat v2 archive metadata without item_ptrs as broken, refs #8649 - #10523

Open
ThomasWaldmann wants to merge 1 commit into
borgbackup:masterfrom
ThomasWaldmann:check-missing-item-ptrs
Open

ThomasWaldmann wants to merge 1 commit into
borgbackup:masterfrom
ThomasWaldmann:check-missing-item-ptrs

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Authenticated v2 archive metadata that lacks item_ptrs crashed borg check with AttributeError: attribute item_ptrs not found, because the archive loop only verified archive.version before reading archive.item_ptrs.

check now treats v2 archive metadata without item_ptrs, or with the v1 items key as well, like other broken archive metadata (missing or integrity error):

  • without --repair: logs Archive metadata block <id> is invalid: needs item_ptrs and no items plus Would delete broken archive ..., flags an error and continues with the next archive.
  • with --repair: deletes the archive, consistent with the existing handling of unusable archive metadata.

Rejecting the "both keys" case is consistent with the "exactly one of item_ptrs, items" check that #10522 adds to Archive._load_meta / Archives._parse_archive_meta; otherwise check --repair would rebuild such an archive with the stale items key kept.

Test: test_archive_metadata_invalid_item_ptrs in check_cmd_test.py (variants: no item_ptrs, both keys) fails on master and passes with the fix.

🤖 Generated with Claude Code

…rgbackup#8649

Authenticated archive metadata that lacks item_ptrs (or also has the v1
items key) crashed borg check with an AttributeError. Report it like
other broken archive metadata and delete the archive with --repair.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.34%. Comparing base (0638531) to head (5194e28).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10523      +/-   ##
==========================================
+ Coverage   89.32%   89.34%   +0.01%     
==========================================
  Files         104      104              
  Lines       20079    20088       +9     
  Branches     3152     3154       +2     
==========================================
+ Hits        17936    17947      +11     
+ Misses       1484     1481       -3     
- Partials      659      660       +1     

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

This branch has not been deployed

No deployments
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