linux default restore only user xattrs, doc update

* On Linux restore only user.* xattrs by default
* restore all for other OSs
* Update docs and changelog about the new restore
flags --exclude-xattr and --include-xattr

Signed-off-by: Tesshu Flower <tflower@redhat.com>
This commit is contained in:
Tesshu Flower
2025-01-10 15:13:45 -05:00
parent 24422e20a6
commit 3ac697d03d
3 changed files with 48 additions and 1 deletions
+10 -1
View File
@@ -3,6 +3,7 @@ package main
import (
"context"
"path/filepath"
"runtime"
"time"
"github.com/restic/restic/internal/debug"
@@ -300,6 +301,14 @@ func getXattrSelectFilter(opts RestoreOptions) (func(xattrName string) bool, err
}, nil
}
// no includes or excludes, set default of including all xattrs
// User has not specified any xattr includes or excludes
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
}