diff --git a/common/hash_data_adapter_xattr.go b/common/hash_data_adapter_xattr.go index 990686896..b4a15c9eb 100644 --- a/common/hash_data_adapter_xattr.go +++ b/common/hash_data_adapter_xattr.go @@ -10,11 +10,12 @@ import ( "fmt" "golang.org/x/sys/unix" "path/filepath" - "strings" ) // ===== OS-Specific hash adapter changes ===== +const AzCopyHashXattrName = "user" + AzCopyHashDataStream + func (HashStorageMode) XAttr() HashStorageMode { return 11 } // It's OK if OS-specific options overlap, but we should leave some room for the agnostic options func (e HashStorageMode) osDefault() HashStorageMode { return e.XAttr() } @@ -52,7 +53,7 @@ func (a *XAttrHashDataAdapter) GetHashData(relativePath string) (*SyncHashData, buf := make([]byte, 512) // 512 bytes should be plenty of space retry: - sz, err := unix.Getxattr(metaFile, strings.TrimPrefix(AzCopyHashDataStream, "."), buf) // MacOS doesn't take well to the dot(?) + sz, err := unix.Getxattr(metaFile, AzCopyHashXattrName, buf) // MacOS doesn't take well to the dot(?) if err != nil { if err == unix.ERANGE { // But just in case, let's safeguard against it and re-call with a larger buffer. buf = make([]byte, len(buf) * 2) @@ -89,7 +90,7 @@ func (a *XAttrHashDataAdapter) SetHashData(relativePath string, data *SyncHashDa return fmt.Errorf("failed to marshal xattr: %w", err) } - err = unix.Setxattr(metaFile, strings.TrimPrefix(AzCopyHashDataStream, "."), buf, 0) // Default flags == create or replace + err = unix.Setxattr(metaFile, AzCopyHashXattrName, buf, 0) // Default flags == create or replace if err != nil { return fmt.Errorf("failed to write xattr: %w; consider utilizing an OS-agnostic hash storage mode", err) }