-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for extended attributes on symlinks #4379
Conversation
Linux allows the use of non-`user.` extended attributes on symlinks. One of the main users of this functionality is SELinux's `security.selinux` xattr for storing a path's label. By storing symlink xattrs, restic is now suitable for backing up the root filesystem on Linux distributions that use SELinux. This commit adds support for symlink xattrs when backing up data, restoring data, and mounting snapshots via a fuse mount. All calls to the xattr library have been updated to the use `L` variants of the various functions, which always operate on the path given, without following symlinks. Fixes: #4375 Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
LGTM. Looks like we previously backed up the wrong xattrs for symlinks (the ones for the target file). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I've added amount of test coverage for extended attributes. The tests in restic/node only use files/dirs+xattrs as we can't write arbitrary xattrs for symlinks. Thus the tests somewhat miss the point, but should be close enough to ensure that this works.
Regarding other operating systems except for Windows, Linux and macOS we'll just have to wait and see whether this change causes problems.
Thank you! |
Looks like I've been to quick in merging the PR, #4401 fixes the windows build. |
What does this PR change? What problem does it solve?
Linux allows the use of non-
user.
extended attributes on symlinks. One of the main users of this functionality is SELinux'ssecurity.selinux
xattr for storing a path's label. By storing symlink xattrs, restic is now suitable for backing up the root filesystem on Linux distributions that use SELinux.This commit adds support for symlink xattrs when backing up data, restoring data, and mounting snapshots via a fuse mount. All calls to the xattr library have been updated to the use
L
variants of the various functions, which always operate on the path given, without following symlinks.Was the change previously discussed in an issue or on the forum?
Fixes: #4375
Checklist
changelog/unreleased/
that describes the changes for our users (see template).gofmt
on the code in all commits.