From 43b36ad2b0215cf29be54b9aa7e093528de13949 Mon Sep 17 00:00:00 2001 From: Michael Eischer Date: Sun, 25 Aug 2024 23:13:54 +0200 Subject: [PATCH] restore: test timestamps for macOS resource forks are restored correctly --- internal/restic/node_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/internal/restic/node_test.go b/internal/restic/node_test.go index 7991d33e0..642beadc5 100644 --- a/internal/restic/node_test.go +++ b/internal/restic/node_test.go @@ -197,6 +197,20 @@ var nodeTests = []Node{ {"user.foo", []byte("bar")}, }, }, + { + Name: "testXattrFileMacOSResourceFork", + Type: "file", + Content: IDs{}, + UID: uint32(os.Getuid()), + GID: uint32(os.Getgid()), + Mode: 0604, + ModTime: parseTime("2005-05-14 21:07:03.111"), + AccessTime: parseTime("2005-05-14 21:07:04.222"), + ChangeTime: parseTime("2005-05-14 21:07:05.333"), + ExtendedAttributes: []ExtendedAttribute{ + {"com.apple.ResourceFork", []byte("bar")}, + }, + }, } func TestNodeRestoreAt(t *testing.T) { @@ -216,6 +230,11 @@ func TestNodeRestoreAt(t *testing.T) { extAttrArr[i].Name = strings.ToUpper(extAttrArr[i].Name) } } + for _, attr := range test.ExtendedAttributes { + if strings.HasPrefix(attr.Name, "com.apple.") && runtime.GOOS != "darwin" { + t.Skipf("attr %v only relevant on macOS", attr.Name) + } + } // tempdir might be backed by a filesystem that does not support // extended attributes