wasm: make ls pass and prepare more work#11563
Open
sylvestre wants to merge 3 commits intouutils:mainfrom
Open
wasm: make ls pass and prepare more work#11563sylvestre wants to merge 3 commits intouutils:mainfrom
sylvestre wants to merge 3 commits intouutils:mainfrom
Conversation
Add #[cfg(target_os = "wasi")] branches to support building uucore for the wasm32-wasip1 target: - FileInformation: use std::fs::Metadata instead of nix::sys::stat - is_stdin_directory: return false (stdin is never a directory on WASI) - sane_blksize: use default block size (no MetadataExt on WASI) - read_fs_list: return empty list (no mount info on WASI) - into_stdio: convert via File since Stdio::from(OwnedFd) is unavailable
The hostname crate does not support WASI (no OS-level hostname API). Make it an optional dependency and stub it to an empty string on WASI, since hyperlink URLs don't need a hostname in a browser environment.
Now that hostname is optional and uucore has WASI stubs, ls can be built for the wasm32-wasip1 target.
|
GNU testsuite comparison: |
cakebaker
reviewed
Apr 1, 2026
Comment on lines
+1151
to
+1153
| #[cfg(feature = "feat_hostname")] | ||
| static HOSTNAME: LazyLock<OsString> = LazyLock::new(|| hostname::get().unwrap_or_default()); | ||
| #[cfg(not(feature = "feat_hostname"))] |
Contributor
There was a problem hiding this comment.
What's the reason for introducing a new feature instead of using #[cfg(target_os = "wasi")] like in the other files?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.