`feat_wasm` utilities that spawn a child process cannot work under WASI

Aperta
#16,595 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust, wasm
Ambito
cli

Direzione di ricerca

Read docs/src/wasi-test-gaps.md and the feat_wasm handling for nice and split, including tests marked #[uutests::wasi_ignore(NoSubprocessSpawning)]. The issue asks for a product decision among several approaches, so first trace how these utilities behave under WASI and assess the tradeoffs described. Done means agreeing on and documenting a behavior for subprocess-spawning utilities under WASI.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

WASI has no fork/exec/posix_spawn equivalent for a guest module, on both wasm32-wasip1 and wasm32-wasip2. Any utility whose job is to launch another program cannot do that job under WASI, regardless of implementation.

Affects every feat_wasm utility that spawns a child: nice, split. Every such test carries #[uutests::wasi_ignore(NoSubprocessSpawning)].

Impact

nice's only working case under WASI is the no-argument "print current niceness." Any invocation with a command fails. The failure is clean now (see the exit-code issue), but the feature doesn't exist under WASI.

Possible workarounds — checked, neither is real

  • In-process dispatch. coreutils.wasm is a multicall binary with every utility linked in. If the target command matches one of those (e.g. nice echo a b c), we could call its uumain directly instead of exec. But: does nothing for an external program (still no way to load another module); drops the actual point of nice (no priority/SIGHUP concept under WASI anyway, so it'd just run the command, not nice it); doesn't help timeout (no way to preempt a direct call without real threads — see shared-everything-threads, draft, unimplemented); needs new plumbing to expose the dispatch table (currently only in coreutils's generated uutils_map.rs) to individual uu_* crates.
  • WASI preview 3. No process/fork/exec proposal at any phase; wasi:cli has no exec interface. Preview 3's scope is native async, not new capabilities. WebAssembly/WASI#899 (wasi:exec) is open but scoped to spawning other components, not native binaries, and the SIG leans toward handling it via the component model's runtime instantiation rather than a WASI interface. No phase assigned.

Ask

Decide what these utilities should do under feat_wasm:

  • Ship as-is, documenting the exec path as always-failing.
  • Exclude them from feat_wasm since their core function is unreachable.
  • Add in-process dispatch for nice as a best-effort fallback, accepting the semantic change and the new plumbing it needs.
  • Something else, e.g. a dedicated "WASI has no subprocess spawning" error instead of the generic operation not supported on this platform.

Scope/product decision, not a code bug — docs/src/wasi-test-gaps.md already documents the limitation.

Lingua principale
Rust
Stelle
24.4k
Fork
2.2k
Merge medio
2g 23h
PR unite (30g)
402

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di uutils/coreutils

Tutte le issue di uutils/coreutils

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.