diff options
author | Jakob Unterwurzacher | 2025-03-26 22:50:54 +0100 |
---|---|---|
committer | Jakob Unterwurzacher | 2025-03-26 22:50:54 +0100 |
commit | 810f074e75b4251b1520843b42c204e5a6e376d8 (patch) | |
tree | d5edd4a5a1c2557a18232c0841ee28b39beece15 /internal/fusefrontend/node.go | |
parent | 13773f47d6d9aa72da034f2011a84248cbd2f46d (diff) |
fusefrontend: fix unconditional FileGetattrer cast
Essentially a port of
https://github.com/hanwen/go-fuse/commit/531a68551e40e7303e94b53fb3792e6dfb28d15a .
This fixes
panic: interface conversion: *fs.dirStreamAsFile is not fs.FileGetattrer: missing method Getattr
goroutine 20 [running]:
github.com/rfjakob/gocryptfs/v2/internal/fusefrontend.(*Node).Getattr(0x55a7ac9d9090?, {0x55a7ac85a4d8, 0xc0013401c8}, {0x55a7ac80eb40?, 0xc0013401b0}, 0xc000586938)
github.com/rfjakob/gocryptfs/v2/internal/fusefrontend/node.go:74 +0x22c
github.com/hanwen/go-fuse/v2/fs.(*rawBridge).getattr(0xc0000b6180, {0x55a7ac85a4d8, 0xc0013401c8}, 0xc0010ea160, {0x55a7ac80eb40?, 0xc0013401b0}, 0xc000586938)
github.com/hanwen/go-fuse/v2@v2.7.2/fs/bridge.go:569 +0x9b
[...]
which is a bug exposed by a go-fuse update.
Fixes https://github.com/rfjakob/gocryptfs/issues/897
Diffstat (limited to 'internal/fusefrontend/node.go')
-rw-r--r-- | internal/fusefrontend/node.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/fusefrontend/node.go b/internal/fusefrontend/node.go index 687a386..91c947e 100644 --- a/internal/fusefrontend/node.go +++ b/internal/fusefrontend/node.go @@ -71,7 +71,9 @@ func (n *Node) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (ch func (n *Node) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) (errno syscall.Errno) { // If the kernel gives us a file handle, use it. if f != nil { - return f.(fs.FileGetattrer).Getattr(ctx, out) + if fga, ok := f.(fs.FileGetattrer); ok { + return fga.Getattr(ctx, out) + } } dirfd, cName, errno := n.prepareAtSyscallMyself() |