Union mount attempting to write to a read-only upstream

What is the problem you are having with rclone?

According to the documentation for the Union backend:

  • All action policies will filter out remotes which are tagged as read-only.
  • All create policies will filter out remotes which are tagged read-only or no-create.

But this does not appear to always be obeyed.
If I mount a union of a read-only upstream and a writeable local upstream, then modify a file that is only present on the read-only one, rclone keeps on trying to upload that change to the read-only upstream and then failing because it's read-only!

What I would like is for it to do a copy-on-write type of thing and just create that modified file on my local upstream. However, as it is, the VFS cache does keep the change, which is good enough for my purposes (for now). Just would like it to quit trying to upload to a remote that it knows is read-only.

What is your rclone version (output from rclone version)

rclone v1.53.3
- os/arch: linux/amd64
- go version: go1.15.5

Installed using the most recent .deb

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

Ubuntu 20.04.1 LTS "Focal" (64-bit)

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

Local+Local
and
Local+HTTP

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

rclone mount -vv merge: /home/user/my-mount --vfs-cache-mode=writes

The rclone config contents with secrets removed.

  [my-local]
  type = local
  
  [my-remote]
  type = http
  url = http://localhost:8080
  
  [merge]
  type = union
  upstreams = my-remote:/:ro my-local:/home/user/dir
  action_policy = ff
  create_policy = ff
  search_policy = ff

A log from the command with the -vv flag

2021/01/10 22:17:33 DEBUG : INSIDE_SITE/CSS.css: vfs cache: starting upload
2021/01/10 22:17:33 ERROR : INSIDE_SITE/CSS.css: Failed to copy: permission denied
2021/01/10 22:17:33 ERROR : INSIDE_SITE/CSS.css: vfs cache: failed to upload try #1, will retry in 10s: vfs cache: failed to transfer file from cache to remote: permission denied
...

That does sound like a bug to me. The copy on write behaviour is what you want.

Can you create an issue on GitHub with the above it and we can look at fixing it. Thanks.