From 18e9d71d7abe152324cb6d0cb364d03e3d9979d5 Mon Sep 17 00:00:00 2001 From: aneesh-n <99904+aneesh-n@users.noreply.github.com> Date: Sat, 10 Aug 2024 10:38:04 -0600 Subject: [PATCH] Fix review comments --- changelog/unreleased/pull-4980 | 6 ++++-- internal/fs/sd_windows.go | 3 +++ internal/restic/node_windows.go | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changelog/unreleased/pull-4980 b/changelog/unreleased/pull-4980 index afa8a7406..264f347fa 100644 --- a/changelog/unreleased/pull-4980 +++ b/changelog/unreleased/pull-4980 @@ -1,10 +1,12 @@ Bugfix: Skip EA processing in Windows for volumes that do not support EA Restic was failing to backup files on some windows paths like network -drives because of errors while fetching ExtendedAttributes. +drives because of errors while fetching extended attributes. Either they return error codes like windows.E_NOT_SET or windows.ERROR_INVALID_FUNCTION or it results in slower backups. -Restic now completely skips the attempt to fetch Extended Attributes +Restic now completely skips the attempt to fetch extended attributes for such volumes where it is not supported. https://github.com/restic/restic/pull/4980 +https://github.com/restic/restic/issues/4955 +https://github.com/restic/restic/issues/4950 diff --git a/internal/fs/sd_windows.go b/internal/fs/sd_windows.go index 2da1c5df4..0a73cbe53 100644 --- a/internal/fs/sd_windows.go +++ b/internal/fs/sd_windows.go @@ -11,6 +11,7 @@ import ( "unsafe" "github.com/restic/restic/internal/debug" + "github.com/restic/restic/internal/errors" "golang.org/x/sys/windows" ) @@ -60,6 +61,8 @@ func GetSecurityDescriptor(filePath string) (securityDescriptor *[]byte, err err if err != nil { return nil, fmt.Errorf("get low-level named security info failed with: %w", err) } + } else if errors.Is(err, windows.ERROR_NOT_SUPPORTED) { + return nil, nil } else { return nil, fmt.Errorf("get named security info failed with: %w", err) } diff --git a/internal/restic/node_windows.go b/internal/restic/node_windows.go index 34df4e9c1..ceb304d0c 100644 --- a/internal/restic/node_windows.go +++ b/internal/restic/node_windows.go @@ -392,7 +392,7 @@ func (node *Node) fillGenericAttributes(path string, fi os.FileInfo, stat *statT return false, err } if sd, err = fs.GetSecurityDescriptor(path); err != nil { - return true, err + return allowExtended, err } } // Add Windows attributes