WebAssembly / WebAssembly/WASI
[v0.3] When does `DescriptorFlags` get checked?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.8k
- Forks
- 333
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 3
Description
In Wasmtime we have a WASIp1 test that asserts when a file is opened for reading only that writing to it fails. This is then additionally tested on WASIp2 via the WASIp1-to-WASIp2 adapter which bottoms out here. I've noticed that currently the way Wasmtime is implemented write-via-stream succeeds, but then a 0-length write to that stream fails with EBADF on Linux at least.
I don't believe that this was conscious behavior and it just happened to fall out of WASIp1 tests, but I wanted to get something on-the-record here as well. Should write-via-stream check the DescriptorFlags that the file was opened with and reject the call right then-and-there? Or does failure only happen when a write happens? (I assume the former, but wanted to check)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the WASIp1 test in crates/test-programs/src/bin/preview1_file_write.rs and the adapter path in crates/wasi-preview1-component-adapter/src/lib.rs. Compare the observed write-via-stream behavior with the DescriptorFlags expectation and determine whether the issue needs a defined semantic decision or an implementation change, with the existing file-write test indicating completion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, rust, wasm
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100