[v0.3] When does `DescriptorFlags` get checked?

Open
#714 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
32/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
linux, rust, wasm

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.

Description

P-filesystem

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)

Dominant language
Rust
Stars
5.8k
Forks
333
Avg merge
2d 13h
Merged PRs (30d)
3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WebAssembly/WASI

All issues in WebAssembly/WASI

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.