-
Notifications
You must be signed in to change notification settings - Fork 36
wasi:filesystem@0.3.0-rc-2025-09-16: Add tests for mkdir/rmdir #143
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
base: main
Are you sure you want to change the base?
Conversation
995dfc0 to
836df64
Compare
836df64 to
32d7e43
Compare
|
|
||
| async fn test_mkdir_rmdir(dir: &Descriptor) { | ||
| let mkdir = |path: &str| dir.create_directory_at(path.to_string()); | ||
| let rmdir = |path: &str| dir.remove_directory_at(path.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add exploration of behavior further down the tree, where the test creates a dir and then opens it as a Descriptor and performs operations there, most interestingly the operations on .. and ../sibling?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, just gave this a go @pchickey but I don't understand the behavior. Should one be able to work on .. from a child? For me it is failing. I thought that the capabilities were linked more to the set of directories exposed to WASI, and not to the individual directory objects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I certainly did not grasp this wrinkle of the WASI filesystem model, that one cannot .. from a subdir! To me it seems like nonsense to enforce a permission boundary between parts of a guest for files that are by definition reachable from the preopens. I can see why (because of the limitations of RESOLVE_BENEATH and the fact that subdirs can be moved around) but it still seems like nonsense to me. Filed WebAssembly/WASI#856, probably won't go anywhere but one can try.
632b27a to
e890570
Compare
e890570 to
8406bbf
Compare
bf69575 to
e2dae8a
Compare
|
|
||
| // remove-directory-at: async func(path: string) -> result<_, error-code>; | ||
| assert_eq!(rmdir("").await, Err(ErrorCode::NoEntry)); | ||
| assert_eq!(rmdir(".").await, Err(ErrorCode::Invalid)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Windows:
thread '<unnamed>' (1) panicked at src/bin/filesystem-mkdir-rmdir.rs:72:5:
assertion `left == right` failed
left: Err(ErrorCode { code: 0, name: "access", message: "Permission denied, similar to `EACCES` in POSIX." })
right: Err(ErrorCode { code: 11, name: "invalid", message: "Invalid argument, similar to `EINVAL` in POSIX." })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added an exception to allow Access. Discouraging, but let's see if we manage to make it to the end of the file.
e2dae8a to
6bd123f
Compare
|
Blocked on wasmtime Windows bug: bytecodealliance/wasmtime#12178. |
No description provided.