Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`rclone mount` configured by env variables uses invalid VFS cache dir on Windows #4544

Open
nthuemmel opened this issue Aug 31, 2020 · 4 comments · May be fixed by #4769
Open

`rclone mount` configured by env variables uses invalid VFS cache dir on Windows #4544

nthuemmel opened this issue Aug 31, 2020 · 4 comments · May be fixed by #4769

Comments

@nthuemmel
Copy link

@nthuemmel nthuemmel commented Aug 31, 2020

What is the problem you are having with rclone?

Using rclone mount with a non-persistent configuration (all settings given by environment variables) & VFS caching enabled attempts to use a VFS cache dir with illegal characters (:) on Windows.

What is your rclone version (output from rclone version)

rclone v1.52.3
- os/arch: windows/amd64
- go version: go1.14.7

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows Server Core 2019 LTSC (64-bit) Docker Container (but I suspect the problem appears on all Windows versions)

Which cloud storage system are you using? (eg Google Drive)

Seafile (But I suspect the problem appears with all backends)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

$Env:RCLONE_SEAFILE_URL="https://example.com"
$Env:RCLONE_SEAFILE_USER="me@example.com"
$Env:RCLONE_SEAFILE_PASS="mypassword"
$Env:RCLONE_SEAFILE_LIBRARY="mylibrary"
rclone mount :seafile: R: --vfs-cache-mode writes

A log from the command

As soon as attempting to write a file to the mounted drive:

2020/08/30 23:33:45 ERROR : IO error: open RW handle failed to make cache directory: make cache directory failed: mkdir C:\Users\ContainerAdministrator\AppData\Local\rclone\vfs\:seafile: The filename, directory name, or volume label syntax is incorrect.

Workaround

Create a temporary config.

rclone config create seafile seafile
rclone mount seafile: R: --vfs-cache-mode writes

Using --cache-dir does not help, since rclone always appends vfs\:seafile to the custom directory path.

@nthuemmel nthuemmel changed the title `rclone mount` configured by env variables uses invalid VFS cache on Windows `rclone mount` configured by env variables uses invalid VFS cache dir on Windows Aug 31, 2020
@darthShadow
Copy link
Member

@darthShadow darthShadow commented Aug 31, 2020

Does this work as a workaround (from the example in the docs @ https://rclone.org/docs/#config-file):

$Env:RCLONE_CONFIG_MYSEAFILE_TYPE="seafile"
$Env:RCLONE_CONFIG_MYSEAFILE_USER="me@example.com"
$Env:RCLONE_CONFIG_MYSEAFILE_PASS="mypassword"
$Env:RCLONE_CONFIG_MYSEAFILE_LIBRARY="mylibrary"
rclone mount myseafile: R: --vfs-cache-mode writes
@ncw ncw added this to the v1.54 milestone Sep 1, 2020
@ncw
Copy link
Member

@ncw ncw commented Sep 1, 2020

Ah, this is unfortunate! @darthShadow 's workaround should get you going though while we work on a fix.

@nthuemmel
Copy link
Author

@nthuemmel nthuemmel commented Sep 1, 2020

Thanks! I have tested the workaround @darthShadow, and it works very well.

@ncw
Copy link
Member

@ncw ncw commented Oct 30, 2020

If someone wants to have a go at a fix, it should be easy

The problem lines are here

root := file.UNCPath(filepath.Join(config.CacheDir, "vfs", fremote.Name(), fRoot))
fs.Debugf(nil, "vfs cache: root is %q", root)
metaRoot := file.UNCPath(filepath.Join(config.CacheDir, "vfsMeta", fremote.Name(), fRoot))

fremote.Name returns the name of the remote

Probably what we need to do is get fremote.Name() into a variable then do something similar to this

fRoot = strings.Replace(fRoot, ":", "", -1)

Though it might be better to substitute the : with a character that can't appear in remote names but can appear in Windows file names rather than removing it, say =

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.