From fe8163cd17fd2a4753ec2220f79d326e8c924400 Mon Sep 17 00:00:00 2001 From: Vladyslav Date: Fri, 26 Jul 2024 16:15:24 +0300 Subject: [PATCH] Add prefix to the xattr --- common/hash_data_adapter_xattr.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/hash_data_adapter_xattr.go b/common/hash_data_adapter_xattr.go index 990686896..882a4391d 100644 --- a/common/hash_data_adapter_xattr.go +++ b/common/hash_data_adapter_xattr.go @@ -15,6 +15,8 @@ import ( // ===== 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 +54,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 +91,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) }