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

Đang mở
#16,595 7 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust, wasm
Lĩnh vực
cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Rust
Star
24.4k
Fork
2.2k
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
402

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của uutils/coreutils

Tất cả issue của uutils/coreutils

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.