xattrs - restore all by default, doc/chglog update

Signed-off-by: Tesshu Flower <tflower@redhat.com>
This commit is contained in:
Tesshu Flower 2025-01-10 15:25:09 -05:00
parent 3ac697d03d
commit cd84fe0853
No known key found for this signature in database
GPG Key ID: DC7556B1903A252B
3 changed files with 6 additions and 25 deletions

View File

@ -1,22 +1,13 @@
Enhancement: Allow including or excluding extended file attributes Enhancement: Allow including/excluding extended file attributes during restore
during restore.
# Describe the problem in the past tense, the new behavior in the present Restic restore attempts to restore all extended file attributes.
# tense. Mention the affected commands, backends, operating systems, etc.
# If the problem description just says that a feature was missing, then
# only explain the new behavior.
# Focus on user-facing behavior, not the implementation.
# Use "Restic now ..." instead of "We have changed ...".
#
Restic restore used to attempt to restore all extended file attributes.
Now two new command line flags are added to restore to control which Now two new command line flags are added to restore to control which
extended file attributes will be restored. extended file attributes will be restored.
The new flags are `--exclude-xattr` and `--include-xattr`. The new flags are `--exclude-xattr` and `--include-xattr`.
If the flags are not provided, restic will default to restoring If the flags are not provided, restic will default to restoring
only `user` namespaced extended file attributes on Linux, and all all extended file attributes.
extended file attributes on other operating systems.
https://github.com/restic/restic/issues/5089 https://github.com/restic/restic/issues/5089
https://github.com/restic/restic/pull/5129 https://github.com/restic/restic/pull/5129

View File

@ -3,7 +3,6 @@ package main
import ( import (
"context" "context"
"path/filepath" "path/filepath"
"runtime"
"time" "time"
"github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/debug"
@ -301,14 +300,6 @@ func getXattrSelectFilter(opts RestoreOptions) (func(xattrName string) bool, err
}, nil }, nil
} }
// User has not specified any xattr includes or excludes // default to including all xattrs
if runtime.GOOS == "linux" {
// For Linux, set default of including only user.* xattrs
return func(xattrName string) bool {
shouldInclude, _ := filter.IncludeByPattern([]string{"user.*"}, Warnf)(xattrName)
return shouldInclude
}, nil
}
// Not linux, default to including all xattrs
return func(_ string) bool { return true }, nil return func(_ string) bool { return true }, nil
} }

View File

@ -91,10 +91,9 @@ stored explicitly.
Restoring extended file attributes Restoring extended file attributes
---------------------------------- ----------------------------------
By default, user namespaced extended attributes for files are restored on Linux, By default, all extended attributes for files are restored.
and all extended attributes are restored for other operating systems.
Use ``--exclude-xattr`` and ``--include-xattr`` to control which extended Use only ``--exclude-xattr`` or ``--include-xattr`` to control which extended
attributes are restored for files in the snapshot. For example, to restore attributes are restored for files in the snapshot. For example, to restore
user and security namespaced extended attributes for files: user and security namespaced extended attributes for files: