Skip to content

Conversation

@wingo
Copy link
Collaborator

@wingo wingo commented Sep 16, 2025

No description provided.

@wingo wingo force-pushed the filesystem-mkdir-rmdir branch 2 times, most recently from 995dfc0 to 836df64 Compare September 22, 2025 09:57
@wingo wingo changed the title wasi:filesystem@0.3.0-rc-2025-08-15: Add tests for mkdir/rmdir wasi:filesystem@0.3.0-rc-2025-09-16: Add tests for mkdir/rmdir Sep 22, 2025
@wingo wingo force-pushed the filesystem-mkdir-rmdir branch from 836df64 to 32d7e43 Compare September 22, 2025 11:44
@wingo wingo marked this pull request as ready for review September 22, 2025 14:31

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());
Copy link
Contributor

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.

@wingo wingo force-pushed the filesystem-mkdir-rmdir branch 2 times, most recently from 632b27a to e890570 Compare October 7, 2025 12:16
@wingo wingo force-pushed the filesystem-mkdir-rmdir branch from e890570 to 8406bbf Compare December 3, 2025 10:25
@wingo wingo force-pushed the filesystem-mkdir-rmdir branch 5 times, most recently from bf69575 to e2dae8a Compare December 18, 2025 11:09

// remove-directory-at: async func(path: string) -> result<_, error-code>;
assert_eq!(rmdir("").await, Err(ErrorCode::NoEntry));
assert_eq!(rmdir(".").await, Err(ErrorCode::Invalid));
Copy link
Collaborator Author

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." })

Copy link
Collaborator Author

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.

@wingo wingo force-pushed the filesystem-mkdir-rmdir branch from e2dae8a to 6bd123f Compare December 18, 2025 11:20
@wingo
Copy link
Collaborator Author

wingo commented Dec 18, 2025

Blocked on wasmtime Windows bug: bytecodealliance/wasmtime#12178.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants