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

Abierto
#16,595 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
rust, wasm
Área
cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Rust
Estrellas
24.4k
Forks
2.2k
Merge medio
2 d 23 h
PR fusionados (30 d)
402

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de uutils/coreutils

Todos los issues de uutils/coreutils

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.