From 9d8d7ae1f08fae1e0b92cdb40d10899ebe930820 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 3 May 2018 09:45:24 +0100 Subject: [PATCH] mount,cmount: make --noappledouble --noapplexattr and change defaults #2287 Before this change we would unconditionally set the OSXFUSE options noappledouble and noapplexattr. However the noapplexattr options caused problems with copies in the Finder. Now the default for noapplexattr is false so we don't add the option by default and the user can override the defaults using the --noappledouble and --noapplexattr flags. --- cmd/cmount/mount.go | 8 ++++++-- cmd/mount/mount.go | 11 ++++++++--- cmd/mountlib/mount.go | 7 +++++++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/cmd/cmount/mount.go b/cmd/cmount/mount.go index 096710745..b40c7c6c6 100644 --- a/cmd/cmount/mount.go +++ b/cmd/cmount/mount.go @@ -54,8 +54,12 @@ func mountOptions(device string, mountpoint string) (options []string) { // OSX options if runtime.GOOS == "darwin" { options = append(options, "-o", "volname="+mountlib.VolumeName) - options = append(options, "-o", "noappledouble") - options = append(options, "-o", "noapplexattr") + if mountlib.NoAppleDouble { + options = append(options, "-o", "noappledouble") + } + if mountlib.NoAppleXattr { + options = append(options, "-o", "noapplexattr") + } } // Windows options diff --git a/cmd/mount/mount.go b/cmd/mount/mount.go index 5f2ae6573..93b43198a 100644 --- a/cmd/mount/mount.go +++ b/cmd/mount/mount.go @@ -28,9 +28,8 @@ func mountOptions(device string) (options []fuse.MountOption) { options = []fuse.MountOption{ fuse.MaxReadahead(uint32(mountlib.MaxReadAhead)), fuse.Subtype("rclone"), - fuse.FSName(device), fuse.VolumeName(mountlib.VolumeName), - fuse.NoAppleDouble(), - fuse.NoAppleXattr(), + fuse.FSName(device), + fuse.VolumeName(mountlib.VolumeName), // Options from benchmarking in the fuse module //fuse.MaxReadahead(64 * 1024 * 1024), @@ -39,6 +38,12 @@ func mountOptions(device string) (options []fuse.MountOption) { // which is probably related to errors people are having //fuse.WritebackCache(), } + if mountlib.NoAppleDouble { + options = append(options, fuse.NoAppleDouble()) + } + if mountlib.NoAppleXattr { + options = append(options, fuse.NoAppleXattr()) + } if mountlib.AllowNonEmpty { options = append(options, fuse.AllowNonEmptyMount()) } diff --git a/cmd/mountlib/mount.go b/cmd/mountlib/mount.go index 7efecab42..a6fa42202 100644 --- a/cmd/mountlib/mount.go +++ b/cmd/mountlib/mount.go @@ -31,6 +31,8 @@ var ( ExtraFlags []string AttrTimeout = 1 * time.Second // how long the kernel caches attribute for VolumeName string + NoAppleDouble = true // use noappledouble by default + NoAppleXattr = false // do not use noapplexattr by default ) // Check is folder is empty @@ -273,6 +275,11 @@ be copied to the vfs cache before opening with --vfs-cache-mode full. flags.BoolVarP(flagSet, &Daemon, "daemon", "", Daemon, "Run mount as a daemon (background mode).") flags.StringVarP(flagSet, &VolumeName, "volname", "", VolumeName, "Set the volume name (not supported by all OSes).") + if runtime.GOOS == "darwin" { + flags.BoolVarP(flagSet, &NoAppleDouble, "noappledouble", "", NoAppleDouble, "Sets the OSXFUSE option noappledouble.") + flags.BoolVarP(flagSet, &NoAppleXattr, "noapplexattr", "", NoAppleXattr, "Sets the OSXFUSE option noapplexattr.") + } + // Add in the generic flags vfsflags.AddFlags(flagSet)