Skip to content

fix(backup): report unreadable xattrs instead of dropping them - #613

Open
lmtlssss wants to merge 2 commits into
rustic-rs:mainfrom
lmtlssss:fix-report-xattr-read-errors-20261025
Open

lmtlssss wants to merge 2 commits into
rustic-rs:mainfrom
lmtlssss:fix-report-xattr-read-errors-20261025

Conversation

@lmtlssss

Copy link
Copy Markdown

Do not silently omit unreadable extended attributes from backups

Closes #596.

LocalSourceSaveOptions::map_entry currently turns Self::xattrs(entry.path()) errors into an empty attribute list with unwrap_or_default(). A file whose xattrs exist but cannot be read is therefore saved as though it has no xattrs, and backup error reporting does not see that failure.

The narrow fix propagates the ErrorXattr result from the mapper instead. The existing LocalSourceWalker converts that to a source error, and the archiver's report_source_error() records it via Progress::error and increments error_count. An unreadable file entry is therefore reported instead of silently misrepresented. Deliberate set_xattrs=No still performs no xattr reads, and readable files with no attributes still succeed.

Three deterministic regression tests cover:

  • xattrs enabled + injected permission/read error → ErrorXattr returned;
  • xattrs explicitly disabled → reader is never invoked;
  • xattrs enabled and readable empty list → valid empty result.

The tests do not depend on filesystem ACL support or a privileged test runner. Scoped formatter/test qualifications were exercised independently on a GitHub-hosted runner: https://github.com/lmtlssss/rustic_core/actions/runs/40240466719 .

Behavioral tradeoff: a file whose xattrs cannot be read will now be reported as a source error rather than archived with silently incomplete metadata; the archiver continues processing other entries. This is source-level test coverage, not a real macOS deny-readextattr acceptance test. Please review the desired handling of xattr-specific errors before merging.

No repository files, production backups, signing keys, or user data were touched in validation.

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.

Backup silently drops extended attributes it cannot read

1 participant