Skip to content

Commit 09954c4

Browse files
committed
fusefrontend: implement our own Access()
Not having Access() means go-fuse emulates it by looking at Getattr(). This works fine most of the time, but breaks down on sshfs, where sshfs-benchmark.bash shows this: gocryptfs/tests$ ./sshfs-benchmark.bash nuetzlich.net working directory: /tmp/sshfs-benchmark.bash.JQC sshfs mounted: nuetzlich.net:/tmp -> sshfs.mnt gocryptfs mounted: sshfs.mnt/sshfs-benchmark.bash.Wrz/gocryptfs.crypt -> gocryptfs.mnt sshfs-benchmark.bash: sshfs gocryptfs-on-sshfs git init 3.98 6.80 rsync 7.71 10.84 rm -R 4.30rm: descend into write-protected directory 'gocryptfs.mnt/git1'? The go-fuse emulation gets it wrong here because sshfs reports permissions but does not enforce them. Implement it ourselves properly.
1 parent 7d1e48d commit 09954c4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/fusefrontend/node.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut)
9999
return 0
100100
}
101101

102+
func (n *Node) Access(ctx context.Context, mode uint32) syscall.Errno {
103+
dirfd, cName, errno := n.prepareAtSyscallMyself()
104+
if errno != 0 {
105+
return errno
106+
}
107+
defer syscall.Close(dirfd)
108+
109+
err := syscallcompat.Faccessat(dirfd, cName, mode)
110+
return fs.ToErrno(err)
111+
}
112+
102113
// Unlink - FUSE call. Delete a file.
103114
//
104115
// Symlink-safe through use of Unlinkat().

0 commit comments

Comments
 (0)