macOS FUSE-T always wants to write files. --read-only fails and MUST use cache mode

What is the problem you are having with rclone?

I decided to try FUSE-T instead of the "regular" FUSE. With FUSE-T, if I mount with anything other than miminal cache fails. And --read-only fails regardless.

I created a simple local directory of a few files to try to mount and read as a test.

rclone mount src/ mnt/ -vv --log-file reg_mount.log

When I try to cat a file in the mount, it FAILS:

$ cat file1.txt
cat: file1.txt: Input/output error

reg_mount.log (10.7 KB)

The following WORKS:

$ rclone mount src/ mnt/ -vv --vfs-cache-mode minimal --log-file minimal_mount.log

minimal_mount.log (15.2 KB)

And the following FAILS (with a different error)

$ rclone mount src/ mnt/ -vv --vfs-cache-mode minimal --read-only --log-file minimal_readonly_mount.log
$ cat file1.txt
cat: file1.txt: Permission denied

minimal_readonly_mount.log (12.3 KB)

any vfs cache < full doesn't make sense with read only so I try that too

$ rclone mount src/ mnt/ -vv --vfs-cache-mode full --read-only --log-file full_readonly_mount.log
$ cat file1.txt
cat: file1.txt: Permission denied

full_readonly_mount.log (12.9 KB)

Run the command 'rclone version' and share the full output of the command.

rclone v1.61.1
- os/version: darwin 12.6.3 (64 bit)
- os/kernel: 21.6.0 (x86_64)
- os/type: darwin
- os/arch: amd64
- go/version: go1.19.4
- go/linking: dynamic
- go/tags: cmount

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

Local for testing with mount

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

See narrative at first prompt. It includes it

The rclone config contents with secrets removed.

N/A -- Local

A log from the command with the -vv flag

See narrative at first prompt. It is included.

From your first example this appears to be the problem

The file1.txt exists

2023/01/25 09:40:09 DEBUG : /file1.txt: Getattr: fh=0xFFFFFFFFFFFFFFFF
2023/01/25 09:40:09 DEBUG : /file1.txt: >Getattr: errc=0

We now try to open it with read/write - rclone assumes you want to write here and creates a write file handle. WIthout --vfs-cache-mode we can only read or write not both.

2023/01/25 09:40:09 DEBUG : /file1.txt: OpenEx: flags=0x2
2023/01/25 09:40:09 DEBUG : /file1.txt: OpenFile: flags=O_RDWR, perm=-rwxrwxrwx
2023/01/25 09:40:09 DEBUG : file1.txt: Open: flags=O_RDWR
2023/01/25 09:40:09 DEBUG : file1.txt: >Open: fd=file1.txt (w), err=<nil>
2023/01/25 09:40:09 DEBUG : /file1.txt: >OpenFile: fd=file1.txt (w), err=<nil>
2023/01/25 09:40:09 DEBUG : /file1.txt: >OpenEx: errc=0, fh=0x0

Which then fails when the write only handle is read from.

2023/01/25 09:40:09 DEBUG : /file1.txt: Read: ofst=0, fh=0x0
2023/01/25 09:40:09 ERROR : file1.txt: WriteFileHandle: ReadAt: Can't read and write to file without --vfs-cache-mode >= minimal
2023/01/25 09:40:09 DEBUG : /file1.txt: >Read: n=-1
2023/01/25 09:40:09 DEBUG : /file1.txt: Read: ofst=0, fh=0x0
2023/01/25 09:40:09 ERROR : file1.txt: WriteFileHandle: ReadAt: Can't read and write to file without --vfs-cache-mode >= minimal
2023/01/25 09:40:09 DEBUG : /file1.txt: >Read: n=-1
2023/01/25 09:40:09 DEBUG : /file1.txt: Flush: fh=0x0
2023/01/25 09:40:09 DEBUG : file1.txt: WriteFileHandle.Flush unwritten handle, writing 0 bytes to avoid race conditions
2023/01/25 09:40:09 ERROR : file1.txt: WriteFileHandle: Can't open for write without O_TRUNC on existing file without --vfs-cache-mode >= writes
2023/01/25 09:40:09 DEBUG : /file1.txt: >Flush: errc=-1

On Linux if I strace cat file.txt I can see cat opens the file with O_RDONLY as it should. Assuming it is the same on macOS (I don't know if you can use strace but there is bound to be a similar tool) then the O_RDONLY is being translated by FUSE-T into an O_RDWR which is causing the problem.

So this looks like a bug in FUSE-T at first glance and it might be worth creating a bug here Issues · macos-fuse-t/fuse-t · GitHub if you can verify cat opens the file O_RDONLY.

Ok. I’ll do that when I get to the computer. It worked on regular FUSE so I do suspect the max is doing it correctly and it gets translated wrong.

Side note, I again renew my offer to chip in towards buying you a development/test Mac…

I tested with dtruss (I found the same link before seeing you also linked to it) and it doesn't show anything useful with how it tried to open

open("mnt/file1.txt\0", 0x0, 0x0)		 = -1 13

I did test with a stupid python program that opens as read only (I know many important details may be abstracted away but at the very least, I know it is read-only)

$ python -c "
import sys
with open(sys.argv[1]) as f:
    print(f.read())
" mnt/file1.txt

and it too failed. I will submit to the FUSE-T tracker and point back to this forum post

1 Like
1 Like