From cd84fe085368785cb2e4c8b2b8f3dfe67141dc3c Mon Sep 17 00:00:00 2001 From: Tesshu Flower Date: Fri, 10 Jan 2025 15:25:09 -0500 Subject: [PATCH] xattrs - restore all by default, doc/chglog update Signed-off-by: Tesshu Flower --- changelog/unreleased/issue-5089 | 15 +++------------ cmd/restic/cmd_restore.go | 11 +---------- doc/050_restore.rst | 5 ++--- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/changelog/unreleased/issue-5089 b/changelog/unreleased/issue-5089 index 51b5a679c..43c5c8366 100644 --- a/changelog/unreleased/issue-5089 +++ b/changelog/unreleased/issue-5089 @@ -1,22 +1,13 @@ -Enhancement: Allow including or excluding extended file attributes -during restore. +Enhancement: Allow including/excluding extended file attributes during restore -# Describe the problem in the past tense, the new behavior in the present -# 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. +Restic restore attempts to restore all extended file attributes. Now two new command line flags are added to restore to control which extended file attributes will be restored. The new flags are `--exclude-xattr` and `--include-xattr`. If the flags are not provided, restic will default to restoring -only `user` namespaced extended file attributes on Linux, and all -extended file attributes on other operating systems. +all extended file attributes. https://github.com/restic/restic/issues/5089 https://github.com/restic/restic/pull/5129 diff --git a/cmd/restic/cmd_restore.go b/cmd/restic/cmd_restore.go index 870d496c9..7a3b029da 100644 --- a/cmd/restic/cmd_restore.go +++ b/cmd/restic/cmd_restore.go @@ -3,7 +3,6 @@ package main import ( "context" "path/filepath" - "runtime" "time" "github.com/restic/restic/internal/debug" @@ -301,14 +300,6 @@ func getXattrSelectFilter(opts RestoreOptions) (func(xattrName string) bool, err }, nil } - // 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 + // default to including all xattrs return func(_ string) bool { return true }, nil } diff --git a/doc/050_restore.rst b/doc/050_restore.rst index 4ca738a3f..b37f3c4fb 100644 --- a/doc/050_restore.rst +++ b/doc/050_restore.rst @@ -91,10 +91,9 @@ stored explicitly. Restoring extended file attributes ---------------------------------- -By default, user namespaced extended attributes for files are restored on Linux, -and all extended attributes are restored for other operating systems. +By default, all extended attributes for files are restored. -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 user and security namespaced extended attributes for files: