I was going to test things out and may have found a bug,
The TL;DR is, using a Local remote on a Union lists the files, but can't actually read them.
Here's what I've found,
My test configuration,
[Local]
type = local
[Union-epff-local]
type = union
upstreams = Local: GDrive:test/dir
search_policy = epff
cache_time = 1
Local directory,
$ ls
file_1.txt file_local.txt
Remote directory,
$ rclone ls GDrive:/test/dir
7 file_remote.txt
7 file_1.txt
Notes:
- GDrive is just a
drive
remote. type drive
, scope drive
. In case that changes anything.
- All plain text files.
- Content of local files have "Local" in them.
- Content of remote files have "Remote" in them.
First test, ls
shows all files with all 4 combinations
$ rclone ls Union-epff-local:
6 file_1.txt
6 file_local.txt
7 file_remote.txt
Now, this is what looks to be a bug with using the local
type remote on a union,
$ rclone -vvvvv cat Union-epff-local:file_local.txt
2021/05/08 17:32:47 DEBUG : Using config file from "/Users/me/.config/rclone/rclone.conf"
2021/05/08 17:32:47 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vvvvv" "cat" "Union-epff-local:file_local.txt"]
2021/05/08 17:32:47 DEBUG : Creating backend with remote "Union-epff-local:file_local.txt"
2021/05/08 17:32:47 DEBUG : Creating backend with remote "GDrive:test/dir"
2021/05/08 17:32:47 DEBUG : Creating backend with remote "Local:"
2021/05/08 17:32:47 DEBUG : fs cache: renaming cache item "Local:" to be canonical "Local:/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 17:32:47 DEBUG : Creating backend with remote "Local:/file_local.txt"
2021/05/08 17:32:47 DEBUG : Creating backend with remote "GDrive:test/dir/file_local.txt"
2021/05/08 17:32:48 DEBUG : union root 'file_local.txt': actionPolicy = *policy.EpAll, createPolicy = *policy.EpMfs, searchPolicy = *policy.EpFF
2021/05/08 17:32:48 ERROR : : error listing: directory not found
2021/05/08 17:32:49 DEBUG : 8 go routines active
2021/05/08 17:32:49 Failed to cat with 2 errors: last error was: directory not found
This does work,
$ rclone -vvvvv cat Local:file_local.txt
2021/05/08 17:26:09 DEBUG : Using config file from "/Users/me/.config/rclone/rclone.conf"
2021/05/08 17:26:09 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vvvvv" "cat" "Local:file_local.txt"]
2021/05/08 17:26:09 DEBUG : Creating backend with remote "Local:file_local.txt"
2021/05/08 17:26:09 DEBUG : fs cache: adding new entry for parent of "Local:file_local.txt", "Local:/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 17:26:09 DEBUG : file_1.txt: Excluded
Local
2021/05/08 17:26:09 DEBUG : 4 go routines active
This also works,
$ rclone -vvvvv cat Union-epall-remote:file_remote.txt
2021/05/08 17:39:01 DEBUG : Using config file from "/Users/me/.config/rclone/rclone.conf"
2021/05/08 17:39:01 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vvvvv" "cat" "Union-epall-remote:file_remote.txt"]
2021/05/08 17:39:01 DEBUG : Creating backend with remote "Union-epall-remote:file_remote.txt"
2021/05/08 17:39:01 DEBUG : Creating backend with remote "GDrive:test/dir"
2021/05/08 17:39:01 DEBUG : Creating backend with remote "Local:"
2021/05/08 17:39:01 DEBUG : fs cache: renaming cache item "Local:" to be canonical "Local:/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 17:39:01 DEBUG : Creating backend with remote "Local:/file_remote.txt"
2021/05/08 17:39:02 DEBUG : Creating backend with remote "GDrive:test/dir/file_remote.txt"
2021/05/08 17:39:03 DEBUG : fs cache: adding new entry for parent of "GDrive:test/dir/file_remote.txt", "GDrive:test/dir"
2021/05/08 17:39:03 DEBUG : union root 'file_remote.txt': actionPolicy = *policy.EpAll, createPolicy = *policy.EpMfs, searchPolicy = *policy.EpAll
2021/05/08 17:39:03 DEBUG : file_1.txt: Excluded
REMOTE
2021/05/08 17:39:03 DEBUG : 8 go routines active
Now, I know I can also pass a local path and that works,
$ rclone -vvvvv cat ./file_local.txt
2021/05/08 17:25:17 DEBUG : Using config file from "/Users/me/.config/rclone/rclone.conf"
2021/05/08 17:25:17 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vvvvv" "cat" "./file_local.txt"]
2021/05/08 17:25:17 DEBUG : Creating backend with remote "./file_local.txt"
2021/05/08 17:25:17 DEBUG : fs cache: adding new entry for parent of "./file_local.txt", "/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 17:25:17 DEBUG : file_1.txt: Excluded
Local
2021/05/08 17:25:17 DEBUG : 4 go routines active
So I tried updating my configuration to use an actual path and that seems to work,
[Union-epff-local]
type = union
upstreams = . GDrive:test/dir
search_policy = epff
cache_time = 1
Then tried reading a local and a remote file which works,
$ rclone -vvvvv cat Union-epff-local:file_local.txt$
2021/05/08 18:09:49 DEBUG : Using config file from "/Users/me/.config/rclone/rclone.conf"
2021/05/08 18:09:49 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vvvvv" "cat" "Union-epff-local:file_local.txt"]
2021/05/08 18:09:49 DEBUG : Creating backend with remote "Union-epff-local:file_local.txt"
2021/05/08 18:09:49 DEBUG : Creating backend with remote "GDrive:test/dir"
2021/05/08 18:09:49 DEBUG : Creating backend with remote "."
2021/05/08 18:09:49 DEBUG : fs cache: renaming cache item "." to be canonical "/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 18:09:49 DEBUG : Creating backend with remote "file_local.txt"
2021/05/08 18:09:49 DEBUG : fs cache: adding new entry for parent of "file_local.txt", "/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 18:09:49 DEBUG : Creating backend with remote "GDrive:test/dir/file_local.txt"
2021/05/08 18:09:50 DEBUG : union root 'file_local.txt': actionPolicy = *policy.EpAll, createPolicy = *policy.EpMfs, searchPolicy = *policy.EpFF
2021/05/08 18:09:50 DEBUG : file_1.txt: Excluded
Local
2021/05/08 18:09:50 DEBUG : 8 go routines active
$ rclone -vvvvv cat Union-epff-local:file_remote.txt$
2021/05/08 18:09:55 DEBUG : Using config file from "/Users/me/.config/rclone/rclone.conf"
2021/05/08 18:09:55 DEBUG : rclone: Version "v1.55.1" starting with parameters ["rclone" "-vvvvv" "cat" "Union-epff-local:file_remote.txt"]
2021/05/08 18:09:55 DEBUG : Creating backend with remote "Union-epff-local:file_remote.txt"
2021/05/08 18:09:55 DEBUG : Creating backend with remote "GDrive:test/dir"
2021/05/08 18:09:55 DEBUG : Creating backend with remote "."
2021/05/08 18:09:55 DEBUG : fs cache: renaming cache item "." to be canonical "/Users/me/PhpstormProjects/rpi/tmp"
2021/05/08 18:09:55 DEBUG : Creating backend with remote "file_remote.txt"
2021/05/08 18:09:55 DEBUG : fs cache: renaming cache item "file_remote.txt" to be canonical "/Users/me/PhpstormProjects/rpi/tmp/file_remote.txt"
2021/05/08 18:09:55 DEBUG : Creating backend with remote "GDrive:test/dir/file_remote.txt"
2021/05/08 18:09:56 DEBUG : fs cache: adding new entry for parent of "GDrive:test/dir/file_remote.txt", "GDrive:test/dir"
2021/05/08 18:09:56 DEBUG : union root 'file_remote.txt': actionPolicy = *policy.EpAll, createPolicy = *policy.EpMfs, searchPolicy = *policy.EpFF
2021/05/08 18:09:56 DEBUG : file_1.txt: Excluded
REMOTE
2021/05/08 18:09:57 DEBUG : 8 go routines active
I was going to open this as an issue on Github but it asks for a link to the forum post. So I'm just documenting it here.