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

オープン
#16,595 コメント 7 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust, wasm
領域
cli

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Rust
スター
24.4k
フォーク
2.2k
平均マージ
2日 23時間
マージ済み PR(30日)
402

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

uutils/coreutils のほかの issue

uutils/coreutils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。