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

未关闭
#16,595 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
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 小时
30 天内合并 PR
402

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

uutils/coreutils 的其他 Issue

查看 uutils/coreutils 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。