From 66e08e0cc8972000d84a61f262286f5644d9fdee Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Tue, 31 Mar 2020 12:16:03 +0100 Subject: [PATCH] mount: warn if --allow-non-empty used on Windows and clarify docs --- cmd/mountlib/mount.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/mountlib/mount.go b/cmd/mountlib/mount.go index cd2b795d3..6b4d34874 100644 --- a/cmd/mountlib/mount.go +++ b/cmd/mountlib/mount.go @@ -116,13 +116,16 @@ foreground mode by default, use the --daemon flag to specify background mode mod Background mode is only supported on Linux and OSX, you can only run mount in foreground mode on Windows. -Start the mount like this +On Linux/macOS/FreeBSD Start the mount like this where ` + "`/path/to/local/mount`" + ` +is an **empty** **existing** directory. rclone ` + commandName + ` remote:path/to/files /path/to/local/mount -Or on Windows like this where X: is an unused drive letter +Or on Windows like this where ` + "`X:`" + ` is an unused drive letter +or use a path to **non-existent** directory. rclone ` + commandName + ` remote:path/to/files X: + rclone ` + commandName + ` remote:path/to/files C:\path\to\nonexistent\directory When running in background mode the user will have to stop the mount manually (specified below). @@ -312,6 +315,8 @@ be copied to the vfs cache before opening with --vfs-cache-mode full. if err != nil { log.Fatalf("Fatal error: %v", err) } + } else if AllowNonEmpty && runtime.GOOS == "windows" { + fs.Logf(nil, "--allow-non-empty flag does nothing on Windows") } // Work out the volume name, removing special @@ -348,7 +353,7 @@ be copied to the vfs cache before opening with --vfs-cache-mode full. cmdFlags := commandDefinition.Flags() flags.BoolVarP(cmdFlags, &DebugFUSE, "debug-fuse", "", DebugFUSE, "Debug the FUSE internals - needs -v.") // mount options - flags.BoolVarP(cmdFlags, &AllowNonEmpty, "allow-non-empty", "", AllowNonEmpty, "Allow mounting over a non-empty directory.") + flags.BoolVarP(cmdFlags, &AllowNonEmpty, "allow-non-empty", "", AllowNonEmpty, "Allow mounting over a non-empty directory (not Windows).") flags.BoolVarP(cmdFlags, &AllowRoot, "allow-root", "", AllowRoot, "Allow access to root user.") flags.BoolVarP(cmdFlags, &AllowOther, "allow-other", "", AllowOther, "Allow access to other users.") flags.BoolVarP(cmdFlags, &DefaultPermissions, "default-permissions", "", DefaultPermissions, "Makes kernel enforce access control based on the file mode.")