Skip to content

fix: return exit code 3 when backup source files are unreadable - #1908

Open
BradKollmyer wants to merge 2 commits into
rustic-rs:mainfrom
BradKollmyer:fix/backup-exit-code-3-unreadable-files
Open

fix: return exit code 3 when backup source files are unreadable#1908
BradKollmyer wants to merge 2 commits into
rustic-rs:mainfrom
BradKollmyer:fix/backup-exit-code-3-unreadable-files

Conversation

@BradKollmyer

Copy link
Copy Markdown

Summary

  • exit 3 after a successful snapshot if some source files/directories could not be read
  • print restic's warning: Warning: at least one source file could not be read
  • with --json / --json-progress, emit restic-compatible JSON error lines and a final exit_error with code: 3
  • include error_count on JSON status messages
  • document backup exit codes in --help

Depends on rustic-rs/rustic_core#561 (SnapshotSummary.error_count and Progress::error). CI will not compile against crates.io rustic_core 0.13.0 until that lands and is released.

Why

restic reports exit code 3 (and JSON exit_error) when source data is unreadable, while still creating a snapshot of the remaining files. rustic currently exits 0 in that case, so scripts cannot detect incomplete backups.

Validation

  • cargo test --test backup_restore test_backup_unreadable_file --offline (unix)
  • existing backup_restore tests still pass
  • cargo fmt / clippy on the changed files

Match restic: still save the snapshot, warn, and exit 3. With JSON
output, emit per-file error messages and a final exit_error with
code 3.
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