xia-chao opened PR #14533 from xia-chao:empty-write-noop to bytecodealliance:main:
Empty writes must not trap. In
wasi:io,check-writereturningok(0)still permitslen == 0. The file output stream rejected an empty write while a write was in flight, aborting the guest.
xia-chao requested rvolosatovs for a review on PR #14533.
xia-chao requested wasmtime-wasi-reviewers for a review on PR #14533.
xia-chao requested cfallin for a review on PR #14533.
xia-chao requested wasmtime-core-reviewers for a review on PR #14533.
github-actions[bot] added the label wasi on PR #14533.
alexcrichton commented on PR #14533:
To me this seems like an edge case where the spec is probably ambiguous about what's supposed to happen. Is this motivated by real-world usage? Or an audit? (or is the spec actually precise in this respect and I'm misremembering?)
xia-chao commented on PR #14533:
An audit, not a user report.
You can take a look at the following code!
xia-chao commented on PR #14533:
The spec is clear: write requires len(contents) <= n, and check-write can return ok(0). So write([]) after ok(0) is valid.
:thumbs_up: alexcrichton submitted PR review:
Sounds reasonable to me :+1:
alexcrichton added PR #14533 wasi:io: do not trap on a zero-length write to the merge queue.
:check: alexcrichton merged PR #14533.
alexcrichton removed PR #14533 wasi:io: do not trap on a zero-length write from the merge queue.
Last updated: Oct 11 2026 at 04:10 UTC