From 810f074e75b4251b1520843b42c204e5a6e376d8 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Wed, 26 Mar 2025 22:50:54 +0100 Subject: 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 --- internal/fusefrontend/node.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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() -- cgit v1.2.3