Skip to content

repo-list, compact: handle archives with a missing metadata object, fixes #10435 - #10437

Merged
ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:repo-list-missing-archive-10435
Sep 26, 2026
Merged

ThomasWaldmann merged 1 commit into
borgbackup:masterfrom
ThomasWaldmann:repo-list-missing-archive-10435

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

If an archive's metadata object is missing or invalid while its archives/ entry still exists, Archives.list() yields a placeholder ArchiveInfo for it (name archive-does-not-exist / archive-metadata-has-integrity-error), but opening it as an Archive raised Archive.DoesNotExist, aborting several commands with rc 31.

  • ArchiveFormatter: if the archive can not be opened, use the placeholder values of the ArchiveInfo and defaults for comment/tags/username/hostname/etc., so borg repo-list (also --deleted, --json) and borg prune --list continue.
  • borg compact: skip such a soft-deleted archive with the "cannot be fully preserved" warning (as documented in mark_soft_deleted_used()) and go on compacting.
  • Archive.DoesNotExist: show a binary archive id as hex instead of raw bytes.
  • borg check --format: keep using the name/timestamp/hex-id fallback for such archives (it relied on the formatter raising).

Regression tests added for repo-list and compact; they fail without the fix.

Fixes #10435.

🤖 Generated with Claude Code

…ixes borgbackup#10435

If an archive's metadata object is missing or invalid while its archives/ entry
still exists, Archives.list() yields a placeholder ArchiveInfo for it, but
opening it as an Archive raises Archive.DoesNotExist.

- ArchiveFormatter: use the placeholder values of the ArchiveInfo (and defaults)
  if the archive can not be opened, so repo-list (and prune --list) go on.
- compact: skip such a soft-deleted archive with the "cannot be fully preserved"
  warning, as documented in mark_soft_deleted_used(), instead of aborting.
- Archive.DoesNotExist: show a binary archive id as hex.
- check --format: keep using the fallback format for such archives.

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

codecov Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.62%. Comparing base (cce5c99) to head (9b3b7eb).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/borg/helpers/parseformat.py 73.33% 4 Missing ⚠️
src/borg/archive.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10437      +/-   ##
==========================================
- Coverage   88.65%   88.62%   -0.03%     
==========================================
  Files         103      103              
  Lines       19217    19229      +12     
  Branches     2993     2994       +1     
==========================================
+ Hits        17036    17041       +5     
- Misses       1513     1522       +9     
+ Partials      668      666       -2     

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

@ThomasWaldmann
ThomasWaldmann merged commit 69f7bb2 into borgbackup:master Sep 26, 2026
25 of 27 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the repo-list-missing-archive-10435 branch September 26, 2026 23:40
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.

borg2: repo-list and compact abort (rc 31) on an archive with a missing metadata object

1 participant