go-nfs icon indicating copy to clipboard operation
go-nfs copied to clipboard

small changes for plan 9 in Truncate and GetFileInfo; NFS server now works on Plan 9

Open rminnich opened this issue 6 months ago • 2 comments

rminnich avatar Jul 02 '25 22:07 rminnich

I don't understand either of these changes

  • first commit resubmits https://github.com/willscott/go-nfs/pull/141 which you haven't justified
  • second commit does not apply to truncate, and I can't find any documentation for why the 'exclusive' bit in opening a file is an issue in plan 9

willscott avatar Jul 03 '25 14:07 willscott

ah, file_other.go was not there when I wrote file_plan9.go

As for O_EXCL, I see the actual problem: linux: " In general, the behavior of O_EXCL is undefined if it is used without O_CREAT. There is one ex‐ ception: on Linux 2.6 and later, O_EXCL can be used without O_CREAT if pathname refers to a block device. If the block device is in use by the system (e.g., mounted), open() fails with the error EBUSY."

Plan 9: O_EXCL only makes sense for create.

The flags currently are: os.O_WRONLY|os.O_EXCL

I don't think it even makes sense to use O_EXCL at all here, but on Plan 9 you get an error, and on linux you don't.

I think just dropping O_EXCL completely may be the proper fix. But the combination of os.O_WRONLY|os.O_EXCL gets an error on Plan 9.

rminnich avatar Jul 03 '25 16:07 rminnich