Skip to content

restore: clean up error handling when restoring metadata#4958

Merged
MichaelEischer merged 1 commit intorestic:masterfrom
mikix:restore-errors
Aug 3, 2024
Merged

restore: clean up error handling when restoring metadata#4958
MichaelEischer merged 1 commit intorestic:masterfrom
mikix:restore-errors

Conversation

@mikix
Copy link
Copy Markdown
Contributor

@mikix mikix commented Jul 30, 2024

What does this PR change? What problem does it solve?

  • Fix a logic error that instead of reporting the first metadata-setting error that appears, we were instead reporting the last error (and only if the lchown call failed!).
  • Don't show any errors when setting metadata for files in non-root mode (things like timestamps, attributes). Previously, only lchown errors were skipped. But other kinds of attribute errors make sense to skip as well. The code path happened to work correctly before because of the above logic error. But once that was fixed, this change needed to happen too.

Was the change previously discussed in an issue or on the forum?

No - but it's a break out of #4946

Checklist

  • I have read the contribution guidelines.
  • I have enabled maintainer edits.
  • I have added tests for all code changes.
  • I have added documentation for relevant changes (in the manual).
  • There's a new file in changelog/unreleased/ that describes the changes for our users (see template).
  • I have run gofmt on the code in all commits.
  • All commit messages are formatted in the same style as the other commits in the repo.
  • I'm done! This pull request is ready for review.

- Fix a logic error that instead of reporting the *first*
  metadata-setting error that appears, we were instead reporting the
  *last* error (and only if the lchown call failed!).
- Don't show any errors when setting metadata for files in non-root
  mode (things like timestamps, attributes). Previously, only lchown
  errors were skipped. But other kinds of attribute errors make sense
  to skip as well. The code path happened to work correctly before
  because of the above logic error. But once that was fixed, this
  change needed to happen too.
@mikix mikix marked this pull request as ready for review July 30, 2024 23:28
@mikix mikix mentioned this pull request Jul 30, 2024
8 tasks
Copy link
Copy Markdown
Member

@MichaelEischer MichaelEischer left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks a lot for finding and fixing this very old bug!

@MichaelEischer MichaelEischer added this pull request to the merge queue Aug 3, 2024
Merged via the queue into restic:master with commit d4db5a3 Aug 3, 2024
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