Stream: wasmtime

Topic: wasi: path_open


view this post on Zulip Mohamed Abdelfatah (Jul 31 2022 at 17:02):

I was using wasi::path_open on an existing file with the wasi::OFLAGS_EXCL oflag parameter, which should return an error if the file exists.
When I run the program with wasmtime, it returned Ok(), which I suppose not correct, right ?
I tried it with wasmer and it returned wasi::ERRNO_EXIST as I think it should.

Here is the code I used here

Is this a bug in wasmtime, or I am missing something here ?

Contribute to Mo-Fatah/wasi-testsuite development by creating an account on GitHub.

view this post on Zulip Dan Gohman (Aug 01 2022 at 12:13):

It indeed sounds like a bug in wasmtime.

view this post on Zulip Lann Martin (Aug 01 2022 at 12:20):

It looks like your test isn't setting OFLAGS_CREAT.

view this post on Zulip Lann Martin (Aug 01 2022 at 12:21):

I don't know about WASI, but POSIX requires both flags for that behavior.

view this post on Zulip Lann Martin (Aug 01 2022 at 12:24):

Indeed that appears to be what cap-std-sync expects: https://github.com/bytecodealliance/wasmtime/blob/fa36e86f2c45f427e9d8a16f559a2515213ab3d4/crates/wasi-common/cap-std-sync/src/dir.rs#L32-L34

A standalone runtime for WebAssembly. Contribute to bytecodealliance/wasmtime development by creating an account on GitHub.

view this post on Zulip Dan Gohman (Aug 01 2022 at 12:38):

Oh, good spot. Yes, WASI should follow POSIX in this aspect.

view this post on Zulip Mohamed Abdelfatah (Aug 01 2022 at 17:35):

Interesting. I also searched for POSIX and found here in O_EXCL : If O_EXCL is set and O_CREAT is not set, the result is undefined.
So, it is undefined anyway and no behaviour specified.


Last updated: Nov 22 2024 at 17:03 UTC