Skip to content

wasm: make ls pass and prepare more work#11563

Merged
cakebaker merged 3 commits intouutils:mainfrom
sylvestre:wasm-pr1
Apr 1, 2026
Merged

wasm: make ls pass and prepare more work#11563
cakebaker merged 3 commits intouutils:mainfrom
sylvestre:wasm-pr1

Conversation

@sylvestre
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/date-locale-hour (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/rm/isatty (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/csplit/csplit-heap is now passing!
Congrats! The gnu test tests/tail/tail-n0f is now passing!
Note: The gnu test tests/env/env-signal-handler was skipped on 'main' but is now failing.

@sylvestre sylvestre marked this pull request as ready for review March 31, 2026 17:09
@sylvestre sylvestre requested a review from cakebaker March 31, 2026 17:09
Comment thread src/uu/ls/src/display.rs Outdated
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"))]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the reason for introducing a new feature instead of using #[cfg(target_os = "wasi")] like in the other files?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no good reason, updated!

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
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Copy Markdown
Contributor Author

@cakebaker actually, because of this:


   Compiling hostname v0.4.2
error: Unsupported target OS! Create an issue: https://github.com/djc/hostname/issues/new
  --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hostname-0.4.2/src/lib.rs:67:9
   |
67 |         compile_error!("Unsupported target OS! Create an issue: https://github.com/djc/hostname/issues/new");
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `sys`
  --> /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/hostname-0.4.2/src/lib.rs:88:5
   |
88 |     sys::get()
   |     ^^^ use of unresolved module or unlinked crate `sys`
   |
   = help: if you wanted to use a crate named `sys`, use `cargo add sys` to add it to your `Cargo.toml`



@cakebaker
Copy link
Copy Markdown
Contributor

Hm, maybe you can gate the hostname dependency with [target.'cfg(not(target_os = "wasi"))'.dependencies] in ls/Cargo.toml?

The hostname crate does not support WASI (no OS-level hostname API).
Now that hostname is optional and uucore has WASI stubs, ls can be
built for the wasm32-wasip1 target.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 1, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/follow-name (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/dd/no-allocate is now being skipped but was previously passing.

@cakebaker cakebaker merged commit 1e81775 into uutils:main Apr 1, 2026
165 of 166 checks passed
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.

2 participants