Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

cmount: ignore com.apple.* xattrs on the macOS FSKit backend

Eugene0cb6ddada9c3
diff --git a/cmd/cmount/fs.go b/cmd/cmount/fs.go
index 47d23df41..d7b16edd6 100644
--- a/cmd/cmount/fs.go
+++ b/cmd/cmount/fs.go
@@ -536,27 +536,56 @@ func (fsys *FS) Fsyncdir(path string, datasync bool, fh uint64) (errc int) {
return 0
}
+// #9908: simulate macFUSE behaviour (discard setxattr calls) - otherwise Finder cannot copy files onto the mount
+func shouldIgnoreAppleXattr(opt *mountlib.Options) bool {
+ if !opt.NoAppleXattr {
+ return false
+ }
+ if runtime.GOOS != "darwin" {
+ return false
+ }
+ // only flip the behaviour on FSKit
+ for _, o := range opt.ExtraOptions {
+ if strings.TrimSpace(o) == "backend=fskit" {
+ return true
+ }
+ }
+ return false
+}
+
// Setxattr sets extended attributes.
func (fsys *FS) Setxattr(path string, name string, value []byte, flags int) (errc int) {
defer log.Trace(path, "name=%q, value=%q, flags=%d", name, value, flags)("errc=%d", &errc)
+ if shouldIgnoreAppleXattr(fsys.opt) && strings.HasPrefix(name, "com.apple.") {
+ return 0
+ }
return -fuse.ENOSYS
}
// Getxattr gets extended attributes.
func (fsys *FS) Getxattr(path string, name string) (errc int, value []byte) {
defer log.Trace(path, "name=%q", name)("errc=%d, value=%q", &errc, &value)
+ if shouldIgnoreAppleXattr(fsys.opt) && strings.HasPrefix(name, "com.apple.") {
+ return -fuse.ENOATTR, nil
+ }
return -fuse.ENOSYS, nil
}
// Removexattr removes extended attributes.
func (fsys *FS) Removexattr(path string, name string) (errc int) {
defer log.Trace(path, "name=%q", name)("errc=%d", &errc)
+ if shouldIgnoreAppleXattr(fsys.opt) && strings.HasPrefix(name, "com.apple.") {
+ return 0
+ }
return -fuse.ENOSYS
}
// Listxattr lists extended attributes.
func (fsys *FS) Listxattr(path string, fill func(name string) bool) (errc int) {
defer log.Trace(path, "fill=%p", fill)("errc=%d", &errc)
+ if shouldIgnoreAppleXattr(fsys.opt) {
+ return 0
+ }
return -fuse.ENOSYS
}