-
Notifications
You must be signed in to change notification settings - Fork 341
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
feat(snapshots): add support for xattr #3643
base: master
Are you sure you want to change the base?
Conversation
This adds support for reading extended attributes from disk. Attributes() returning a fs.AttributesInfo is added to fs.Entry. Getting the attributes from disk uses github.com/pkg/xattr. fs.AttributesInfo is a map, which when empty is just a pointer. It being a map (as opposed to a slice in restic) helps in comparing if the attributes have changed (no need to allocate a map there and then). Most other changes in snapshot/snapshotfs/* are there to implement the extended fs.Entry interface. Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
Creating a repo and backuping a file with xattrs and seeing it gets restored. ~~~ % ./kopia repository create filesystem --path=/tmp/kopia Enter password to create new repository: Re-enter password for verification: % pwd /home/miek/src/github.com/miekg/tmp % getfacl testfile1 user::rw- user:root:rw- group::rw- group:root:rw- group:miek:rw- mask::rw- other::r-- % ./kopia --log-level=debug snapshot create /home/miek/src/github.com/miekg/tmp/ % ./kopia snapshot list .... 2024-02-12 19:23:57 CET k0e335d9c23c5a20f78e358d1bd286865 2.1 MB drwxrwxr-x files:5 dirs:1 (latest-1..2,hourly-1,daily-1,weekly-1,monthly-1,annual-1) % ./kopia restore k0e335d9c23c5a20f78e358d1bd286865 /tmp/XXXX Restoring to local filesystem (/tmp/XXXX) with parallelism=8... Processed 6 (2.1 MB) of 5 (2.1 MB). Restored 5 files, 1 directories and 0 symbolic links (2.1 MB). % cd /tmp/XXXX % l go.mod go.sum testfile1 tmp* xattr.go % getfacl testfile1 user::rw- user:root:rw- group::rw- group:root:rw- group:miek:rw- mask::rw- other::r-- ~~~ Signed-off-by: Miek Gieben <miek@miek.nl>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #3643 +/- ##
==========================================
+ Coverage 75.86% 77.00% +1.13%
==========================================
Files 470 470
Lines 37301 28537 -8764
==========================================
- Hits 28299 21975 -6324
+ Misses 7071 4624 -2447
- Partials 1931 1938 +7 ☔ View full report in Codecov by Sentry. |
this is promising but needs a lot more work:
|
Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
thanks for your comments
yep
yep, and adding support for openbsd and freebsd
It this with your proposed first point, or is this already expensive in it's current form, where it uploads a nil map if there are no attributes?
can do
based on the first map key? I.e. like --no-axttr woudl exclude those, but leave, say, winacl? Or more detailed on specific axttr fields? |
Signed-off-by: Miek Gieben <miek@miek.nl>
Signed-off-by: Miek Gieben <miek@miek.nl>
This adds support for extended attributes on Unix - although I only tested it manually on Linux.
This should include all the needed bits, but lacks proper tests - I only did a manual tests, referenced in one of the commits, included here again: