github-actions[bot] commented on Issue #2010:
Subscribe to Label Action
cc @kubkon
<details>
This issue or pull request has been labeled: "wasi"Thus the following users have been cc'd because of the following labels:
- kubkon: wasi
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
whitequark commented on Issue #2010:
Would it be possible to add your test case (ported to a test-programs test maybe) to ensure we don't regress this fix?
Sorry, I'm not familiar with this part of wasmtime's testing infrastructure, and the test case is pretty dirty (as-is it uses libc++...). If you have a step-by-step guide for doing this I could do it though!
peterhuene commented on Issue #2010:
No worries! There's a bunch of tests in
crates/test-programs/wasi-tests
that use thewasi
crate to directly test against the Wasmtime's WASI API surface.I think a new test case in there that creates a file with some text, closes it, and then opens it with
OFLAGS_CREAT
ANDOFLAGS_TRUNC
, then reads it to confirm it is truncated would do the trick.I'd be happy to write one if you would like.
peterhuene edited a comment on Issue #2010:
No worries! There's a bunch of tests in
crates/test-programs/wasi-tests
that use thewasi
crate to directly test against the Wasmtime's WASI API surface.I think a new test case in there that creates a file with some text, closes it, and then opens it with
OFLAGS_CREAT | OFLAGS_TRUNC
, then reads it to confirm it is truncated would do the trick.I'd be happy to write one if you would like.
whitequark commented on Issue #2010:
I'd be happy to write one if you would like.
Please do, that would help a lot.
kubkon commented on Issue #2010:
No worries! There's a bunch of tests in
crates/test-programs/wasi-tests
that use thewasi
crate to directly test against the Wasmtime's WASI API surface.I think a new test case in there that creates a file with some text, closes it, and then opens it with
OFLAGS_CREAT | OFLAGS_TRUNC
, then reads it to confirm it is truncated would do the trick.I'd be happy to write one if you would like.
Would it make sense to modify truncation_rights.rs instead of/in addition to adding a new one? It seems this one should already test what has been discussed here, but due to the fact the file is always empty and never reopened, this bug was missed on Windows.
peterhuene commented on Issue #2010:
I think that
truncation_rights
is specifically centered around the WASI right checking whereas the new test would be simply to check thatOFLAGS_TRUNC
was respected properly forpath_open
.Personally I'd prefer two smaller tests to one complicated test.
peterhuene edited a comment on Issue #2010:
I think that
truncation_rights
is specifically centered around the WASI rights checking whereas the new test would be simply to check thatOFLAGS_TRUNC
was respected properly forpath_open
.Personally I'd prefer two smaller tests to one complicated test.
peterhuene commented on Issue #2010:
@kubkon I've pushed up a test case for file truncation. Would you mind reviewing it? I've confirmed the test fails without @whitequark's fix and passes with the fix on Windows.
peterhuene edited a comment on Issue #2010:
No worries! There's a bunch of tests in
crates/test-programs/wasi-tests
that use thewasi
crate to directly test against Wasmtime's WASI API surface.I think a new test case in there that creates a file with some text, closes it, and then opens it with
OFLAGS_CREAT | OFLAGS_TRUNC
, then reads it to confirm it is truncated would do the trick.I'd be happy to write one if you would like.
peterhuene commented on Issue #2010:
Third time's a charm on those force pushes (I was lazy and just
cargo test --feature test_programs
the test programs crate directly, which doesn't error on unused imports when building).
peterhuene edited a comment on Issue #2010:
Third time's a charm on those force pushes (I was lazy and just
cargo test --feature test_programs
the test programs crate directly, which doesn't error on unused imports when building like in CI).
peterhuene commented on Issue #2010:
@whitequark thanks for fixing this!
Last updated: Nov 22 2024 at 16:03 UTC