Stream: git-wasmtime

Topic: wasmtime / issue #11607 wasip3: unexpected error for mkdi...


view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 14:44):

wingo opened issue #11607:

Consider this test for an open Descriptor on a directory, dirfd:

            assert_eq!(dirfd.create_directory_at("".to_string()).await,
                       Err(ErrorCode::Invalid));

I think Invalid is the right error. However instead the error is NoEntry, which corresponds to this statx documentation:

       ENOENT A component of pathname does not exist, or pathname is an empty string and AT_EMPTY_PATH was not specified in flags.

I think that these "at" WASI interfaces should instead avoid syscalling for "", and instead return Invalid.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 14:44):

wingo added the bug label to Issue #11607.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 14:45):

wingo edited issue #11607:

Consider this test for an open Descriptor on a directory, dirfd:

            assert_eq!(dirfd.create_directory_at("".to_string()).await,
                       Err(ErrorCode::Invalid));

I think Invalid is the right error. However instead the error is NoEntry, which corresponds to this statx documentation:

       ENOENT A component of pathname does not exist, or pathname is an empty string and AT_EMPTY_PATH was not specified in flags.

I think that these "at" WASI interfaces should instead avoid syscalling for "", and instead return Invalid.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 14:57):

wingo commented on issue #11607:

Same issue for stat-at(""), open-at(""), readlink-at(""), remove-directory-at(""), possibly others.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 14:58):

wingo commented on issue #11607:

For me the solution probably goes through something like https://github.com/bytecodealliance/wasmtime/issues/11524#issuecomment-3253843726.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 15:08):

wingo edited a comment on issue #11607:

Same issue for stat-at(""), open-at(""), readlink-at(""), remove-directory-at(""), metadata-hash-at(""), possibly others.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 20:18):

alexcrichton added the wasi:impl label to Issue #11607.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 04 2025 at 20:18):

alexcrichton added the wasi label to Issue #11607.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 08 2025 at 20:36):

sunfishcode commented on issue #11607:

What would be the motivation for returning Invalid here?

wasi-filesystem is unfortunately not an advantageous place to have novel opinions about how filesystem APIs should work, because it is constrained by compatibility requirements with underlying host implementations on one side, and in the expectations of applications on the other. If Linux returns ENOENT for statx and openat and friends when given empty strings, then that makes it more likely to be compatible with existing applications than EINVAL.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 09 2025 at 06:50):

wingo commented on issue #11607:

NoEntry to me implies an error originating in the filesystem: some component leading up to the leaf is not present. However here we have no leaf and in fact no path, and because we don't expose an AT_EMPTY_PATH interface, passing "" is simply invalid. If you were designing it today, Invalid is the right return.

I am sympathetic to the compatibility concern but I think that's more a wasi-libc question; in this case, wasmtime is fabricating the ENOENT, it does not come from the kernel.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 11 2025 at 12:14):

sunfishcode commented on issue #11607:

If we use Invalid here, and wish wasi-libc to translate it to ENOENT, then wasi-libc would need to be able to distinguish an Invalid that was caused by an empty path string from an Invalid with any other cause. I suppose that's doable, but it seems awkward to have it redo the error checking the host does.

view this post on Zulip Wasmtime GitHub notifications bot (Sep 12 2025 at 09:20):

wingo commented on issue #11607:

Ah, true. I guess the question is, do you want wasi-libc to translate to ENOENT ? I didn't think that would be necessary, but I can see the value of wasi-filesystem being as close to POSIX as possible if the goal is to have the thinnest wasi-libc.

You know what, thank you for humoring me here, but posix mkdirat specifies ENOENT for empty-string, so I think I am just barking up the wrong tree: https://pubs.opengroup.org/onlinepubs/9699919799.2013edition/functions/mkdir.html. Propose to close this bug as invalid.


Last updated: Dec 06 2025 at 06:05 UTC