dirfs.OpenFile can return ENAMETOOLONG even if that is not defined FS.OpenFile in the interface documentation
karelbilek opened this issue · comments
This is similar to #2101 but it's more general and it basically contains all other errnos.
Basically, dirFS can return a lot more other errnos - not just the few defined here
when the os returns them as a syscall error, and it's in the list here
A trivial repro on macOS (need to run from somewhere where you have access to internal/sysfs/dirfs
)
rootFS := dirfs.DirFS("/")
res, err := rootFS.OpenFile("tmp/"+strings.Repeat("a", 400), sys.O_CREAT, 0)
fmt.Println(res, err)
This should not be possible according to FS.OpenFile documentation:
Again I hit this when I implement my own FS implementation and I am not sure if I should adhere to the doc with the errnos, or just return whatever.
(Sorry if this is duplicate of #2101 and should not be a different issue)
The same repro should work on Linux, max filename length is 255.
I'd say it is not necessary to open an issue for each new error that is not documented :D let's keep it tidy, as I think I have mentioned in #2076 this feature is still experimental so you might find more of these idiosyncrasies. We can continue on this or #2101, as essentially the issue boils down to limited documentation and/or unspecified behavior.
Do follow up with your questions and feedback, all it's welcome.