Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasi: fix wasm-wasi-musl SYMLINK_{NO,}FOLLOW constants and enable tests #22684

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

rootbeer
Copy link
Contributor

@rootbeer rootbeer commented Jan 30, 2025

Zig's copy of the SYMLINK_{NO,}FOLLOW constants from wasi-musl was wrong, as were the IFIFO and IFSOCK file type flags. Fix these up, and add comments pointing to exactly where they come from (as wasi-musl has lots of unused, different definitions of these constants).

Add tests for the Zig convention that WASM preopen 3 is the current working directory. This is true for WASM with or without libc.

Enable several fs and posix tests that are now passing (not necessarily because of this change) on wasm targets.

Fixes #20890.

@alexrp alexrp requested a review from squeek502 January 30, 2025 20:09
Copy link
Collaborator

@squeek502 squeek502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify for myself/others with regards to lib/std/c.zig: the source of truth for the flags is indeed wasi-libc, since those constants are not actually used in the WASI APIs themselves (see lib/std/os/wasi.zig for the WASI constants)

@alexrp alexrp added this to the 0.14.0 milestone Feb 3, 2025
Zig's copy of the `SYMLINK_{NO,}FOLLOW` constants from wasi-musl was
wrong, as were the `IFIFO` and `IFSOCK` file type flags.  Fix these up,
and add comments pointing to exactly where they come from (as the
wasi-musl source has lots of unused, different definitions of these
constants).

Add tests for the Zig convention that WASM preopen 3 is the current
working directory.   This is true for WASM with or without libc.

Enable several fs and posix tests that are now passing (not necessarily
because of this change) on wasm targets.

Fixes ziglang#20890.
@alexrp
Copy link
Member

alexrp commented Feb 9, 2025

@squeek502 is this good to go in your view?

@squeek502
Copy link
Collaborator

Looks good to me

@alexrp alexrp merged commit 138d30b into ziglang:master Feb 9, 2025
9 of 10 checks passed
@rootbeer rootbeer deleted the wasi-constant-fix branch February 9, 2025 16:33
@alexrp alexrp removed this from the 0.14.0 milestone Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

posix.fstatat fails to propogate SYMLINK_NOFOLLOW when linking wasi-libc
3 participants