From d2b5ff8384a80fc8194436836e56a665df1c3c4e Mon Sep 17 00:00:00 2001 From: Leon Brocard Date: Fri, 20 Mar 2026 17:12:55 +0000 Subject: [PATCH] local: fix getXattr returning empty map instead of nil At least on my macOS Sequoia 15.7.4, the system automatically adds a com.apple.provenance xattr to files created by processes. This xattr lacks the "user." prefix so getXattr filters it out, but the metadata map was already allocated, resulting in an empty non-nil map being returned instead of nil. This caused TestMetadata/Symlink/Xattr and TestMetadata/File/Xattr to fail because they assert the return value is nil when no user xattrs are present. The fix checks if the metadata map is empty after filtering and returns nil if so. --- backend/local/xattr.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/local/xattr.go b/backend/local/xattr.go index e34dc02ad..8ca8a7f35 100644 --- a/backend/local/xattr.go +++ b/backend/local/xattr.go @@ -81,6 +81,10 @@ func (o *Object) getXattr() (metadata fs.Metadata, err error) { } metadata[k] = string(v) } + // Return nil if all xattrs were filtered out (e.g. com.apple.provenance on macOS) + if len(metadata) == 0 { + return nil, nil + } return metadata, nil }