Don't crash when calling truncate(1) on a handle without a File.
For all operations that can be applied on file descriptors, we have special treatment to permit the File to be nil. In that case, operations are called against the Node object instead. This check currently seems missing from SetAttr(), causing invocations of the truncate(1) command line tool to cause a crash: panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xa30d0d] goroutine 12 [running]: github.com/hanwen/go-fuse/fuse/nodefs.(*rawBridge).SetAttr(0xc00013ecc0, 0xc0003a8000, 0xc0003ba0f0, 0xa27b98) external/com_github_hanwen_go_fuse/fuse/nodefs/fsops.go:203 +0x58d github.com/hanwen/go-fuse/fuse.doSetattr(0xc0003a4000, 0xc0003ba000) external/com_github_hanwen_go_fuse/fuse/opcode.go:171 +0x64 github.com/hanwen/go-fuse/fuse.(*Server).handleRequest(0xc0003a4000, 0xc0003ba000, 0xc0003ba000) external/com_github_hanwen_go_fuse/fuse/server.go:431 +0x26b github.com/hanwen/go-fuse/fuse.(*Server).loop(0xc0003a4000, 0xc00000b101) external/com_github_hanwen_go_fuse/fuse/server.go:403 +0x18f created by github.com/hanwen/go-fuse/fuse.(*Server).readRequest external/com_github_hanwen_go_fuse/fuse/server.go:291 +0x2d8
Showing
Please register or sign in to comment