diff --git a/changelog/unreleased/issue-4969 b/changelog/unreleased/issue-4969 new file mode 100644 index 000000000..ce76a7389 --- /dev/null +++ b/changelog/unreleased/issue-4969 @@ -0,0 +1,7 @@ +Bugfix: Correctly restore timestamp for files with resource forks on macOS + +On macOS, timestamps were incorrectly restored for files with resource forks. +This has been fixed. + +https://github.com/restic/restic/issues/4969 +https://github.com/restic/restic/pull/5006 diff --git a/internal/restic/node.go b/internal/restic/node.go index 7c1988227..6afdff64a 100644 --- a/internal/restic/node.go +++ b/internal/restic/node.go @@ -249,13 +249,6 @@ func (node Node) restoreMetadata(path string, warn func(msg string)) error { firsterr = errors.WithStack(err) } - if err := node.RestoreTimestamps(path); err != nil { - debug.Log("error restoring timestamps for dir %v: %v", path, err) - if firsterr == nil { - firsterr = err - } - } - if err := node.restoreExtendedAttributes(path); err != nil { debug.Log("error restoring extended attributes for %v: %v", path, err) if firsterr == nil { @@ -270,6 +263,13 @@ func (node Node) restoreMetadata(path string, warn func(msg string)) error { } } + if err := node.RestoreTimestamps(path); err != nil { + debug.Log("error restoring timestamps for %v: %v", path, err) + if firsterr == nil { + firsterr = err + } + } + // Moving RestoreTimestamps and restoreExtendedAttributes calls above as for readonly files in windows // calling Chmod below will no longer allow any modifications to be made on the file and the // calls above would fail.