-
Notifications
You must be signed in to change notification settings - Fork 259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dirfs.OpenFile can return EEXIST even if that is not defined FS.OpenFile in the interface documentation #2101
Comments
When I follow it to the "other side", I see this EEXIST is there. I don't see any list of allowed errnos here https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/docs.md#path_open or here https://wasix.org/docs/api-reference/wasi/path_open so... I guess it can return EEXIST? |
indeed, there are case where we return EEXIST https://github.com/tetratelabs/wazero/blame/main/experimental/sys/fs.go when we do it is usually because there is a test that requires it; e.g. in wasi-testsuite or other test suites. I will double check the docs to make sure they are up to date. |
As written in #2104 I figured out there are other errors that are not in the docs. I wanted to make a PR with all the possible errnos, but then I realized, all I am doing is rewriting https://pubs.opengroup.org/onlinepubs/9699919799/functions/open.html (the ERRORS part) to godoc format. At which point I realized I might be even breaking copyright, as POSIX docs are copyrighted. Wouldn't it be better to just link to the posix errors and say "here, there is a list"? It's documented better than will be here... the list on POSIX docs is very exhaustive. Or, just rewrite the docs from "The below are expected otherwise..." to "Some possible errors: ..."? |
Hm, but only SOME of those actually matter here. Hm. I guess I get back to rewriting. (But in my own words.) edit: hm, no, I will not rewrite this, I can just copy-paste that
|
In the interface FS.OpenFile, you have defined a set of errors that OpenFile can return.
https://github.com/tetratelabs/wazero/blob/ba569623fcb7b32bb8fc64dadc842672befd6819/experimental/sys/fs.go#L34...L39
However, if you follow what DirFS can return, there are more possible errors
https://github.com/tetratelabs/wazero/blob/ba569623fcb7b32bb8fc64dadc842672befd6819/experimental/sys/error.go#L10...L30
For example, if one opens file with O_CREAT and O_EXCL, but the file exists already, POSIX OS will return EEXIST.
I am implementing a custom FS, and I am not sure what to follow; there is a mismatch between the docs say and what the DirFS actually does.
The text was updated successfully, but these errors were encountered: