Skip to content

feat: count unreadable source files during backup - #561

Merged
aawsome merged 4 commits into
rustic-rs:mainfrom
BradKollmyer:fix/backup-unreadable-source-errors
Sep 5, 2026
Merged

feat: count unreadable source files during backup#561
aawsome merged 4 commits into
rustic-rs:mainfrom
BradKollmyer:fix/backup-unreadable-source-errors

Conversation

@BradKollmyer

@BradKollmyer BradKollmyer commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • count source scan and archival errors instead of only logging them
  • report those errors through Progress::error (scan / archival)
  • attach the source path on local walk/open failures
  • expose a SnapshotSummary.error_count for the just-completed backup

Why

restic returns exit code 3 when some source files cannot be read, and still creates a snapshot of the remaining files. rustic currently ignores those errors and exits 0, so automation cannot detect incomplete backups.

Validation

  • cargo test --test integration test_backup_unreadable_file_sets_error_count (unix; chmod 000 file)
  • cargo fmt --all
  • clippy on the changed files

A companion rustic CLI PR will use error_count to exit 3 and emit restic-compatible JSON error / exit_error messages.

Track scan and archival errors instead of silently ignoring them, and
expose the count on SnapshotSummary so callers can return restic exit
code 3 for incomplete snapshots.
@BradKollmyer

Copy link
Copy Markdown
Contributor Author

Companion CLI PR: rustic-rs/rustic#1908

Comment thread crates/core/src/archiver.rs Outdated
Comment thread crates/core/src/progress.rs Outdated
Comment thread crates/core/tests/integration/backup.rs Outdated
Comment thread crates/core/src/repofile/snapshotfile.rs Outdated
Pass source paths as Option through Progress::error instead of empty
strings. Persist SnapshotSummary.error_count when it is non-zero. Drop
the chmod restore in the tempdir test; unlink only needs directory
permissions.
@aawsome aawsome changed the title fix: count unreadable source files during backup feat: count unreadable source files during backup Sep 5, 2026
@aawsome
aawsome enabled auto-merge September 5, 2026 21:55

@aawsome aawsome left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks a lot @BradKollmyer

@aawsome
aawsome added this pull request to the merge queue Sep 5, 2026
Merged via the queue into rustic-rs:main with commit b78f648 Sep 5, 2026
19 of 22 checks passed
@rustic-release-plz rustic-release-plz Bot mentioned this pull request Sep 4, 2026
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.

2 participants