Repository navigation
#1488 wave4b: rust2 library-form batch — factor pathchk ptx shuf csplit nohup groups who - #1577
Merged
Merged
Conversation
caomengxuan666
force-pushed
the
rust2/wave4b
branch
from
November 12, 2026 03:56
59218e8 to
38acf5e
Compare
…s/who) with their setup constants onto main's generator
caomengxuan666
force-pushed
the
rust2/wave4b
branch
from
November 12, 2026 10:24
38acf5e to
ed9beb2
Compare
This was referenced Nov 12, 2026
caomengxuan666
added a commit
that referenced
this pull request
Nov 12, 2026
recover wave4b: restore the eight command sources + shared childproc spawner lost in the #1577 merge
caomengxuan666
added a commit
that referenced
this pull request
Nov 12, 2026
…ets (#1587) (#1588) Fixes #1587 (WinuxCmd 2.0 / rust2 wave — the 1.x C++ spawner keeps its own tracking; this lane touches only the rust2 tree). ## What `timeout`, `nohup` and `nice` resolved children with a CreateProcess-shaped extension allow-list: any existing target without a `.exe/.com/.cmd/.bat` extension — a shebang script, `.js`, `.ps1`, an npm/pnpm-style extensionless shim — exited **126 silently**. The new shared chain in `rust2/crates/winux-cmds/src/childproc.rs` (extracted from `timeout.rs`; the wave4b module shape — PR #1577 carried only the gen-cases graft to main, so `nohup.rs`/`childproc.rs` land here) resolves like `execvp`: 1. as given → PATHEXT variants → PATH search (unchanged native chain); 2. the hit is classified: `.cmd`/`.bat` → COMSPEC (`cmd /d /s /c "..."`); `MZ` magic → native image; `#!` → **`[interpreter, optional-arg, script, ...argv]`** with the interpreter resolved recursively (binfmt_script.c value model: first space/tab splits, ONE optional arg, CR kept — a CRLF shebang misses its interpreter, probed ENOENT); 3. a POSIX-rooted spelling the native chain missed (`/bin/sh`, `/usr/bin/env`) resolves through the product's shell-namespace mapper (`winux-core::path::shell_tree_to_native`), then through its leaf name on PATH; 4. a file with neither magic is the execvp ENOEXEC analog: **126 `Exec format error`** (C-locale GNU wording, byte-probed under WSL coreutils 9.4; ASCII quotes like the rest of the product's diagnostics). Diagnostics follow the measured GNU shapes (WSL coreutils 9.4, `rust2/target/probe-1587/gnu-probe*.sh`): | case | GNU (probed) | WinuxCmd 2.0 now | | --- | --- | --- | | `timeout 5 ./hi.sh` (`#!/bin/sh`) | `hi`, rc 0 | `hi`, rc 0 | | missing command | 127 `failed to run command 'X': No such file or directory` | same | | shebang with missing interpreter | 127 `... 'X': No such file or directory` (kernel ENOENT) | same | | directory operand | 126 `... 'X': Permission denied` | same | | found file, no MZ/`#!` (`./x.js`, plain text) | 126 `Exec format error`* | 126 `Exec format error` | | `timeout 1 sleep 5` | 124 | 124 | \* glibc's execvp additionally retries ENOEXEC through `/bin/sh` (probed: a text file "runs", an empty file exits 0 under WSL GNU). That is a libc extension, not execvp/kernel semantics; per the issue contract WinuxCmd reports `Exec format error` instead. Association-run scripts (.js/.ps1 with no shebang) are the same class — GNU-on-msys launches them through Windows associations, which pure execvp resolution cannot; they now get the diagnostic instead of silence. Also fixed in passing (same extraction): `normalize_entry` required the slash after the drive letter (C++ `childproc.cppm` `is_drive_form`), so `/bin/sh` is no longer mangled into `B:in\sh`; and `nice` rides the shared chain (`build_child_command` keeps its CREATE_SUSPENDED ordering, #1359) so its non-PE children get the same fix. `nohup` lands on main with its spawn family — `-h` now rejects like GNU (`invalid option -- 'h'`, rc 125, probed). ## Verification - Repro matrix (issue + shebang variants + PATHEXT edges), driver-run: `rust2/target/probe-1587/repro-matrix.sh` — hi.sh → `hi` rc 0; hi.cmd rc 0; no-such 127 + message; `timeout 1 sleep 5` = 124; x.js/x.ps1/plain 126 + `Exec format error`; extensionless shim rc 0; `#!/bin/echo` / `#!/bin/echo -n` argv shapes; absolute path; bare name resolving to a `.cmd` on PATH; directory 126; `#!/usr/bin/env sh` chain via a `__RUBASH_SHELL_ROOT` fixture (batch `env.bat` interpreter → `sh` → script, rc 0). - Gate: `timeout` 38 GNU + 3 win, `nohup` 21 GNU + 7 win, `nice` 21 GNU — all GREEN; 15 new rows (tm31–tm41, nh25–nh28) in `gate/gen-cases.py`; ledger `rust2/target/gate/ledger.tsv` (e.g. `tm31 rc(r/g/c)=3/3/126` — the script's exit status now propagates on the rust side while C++ still shows the old silent 126). - `cargo test -p winux-cmds` 489 green; `cargo fmt --check` clean. ## 本 PR 删除了什么 - `timeout.rs` 内联的 execvp 形解析器约 323 行(旧 `ChildResolve` enum、`normalize_entry`、`normalize_path_entries`、`pathext_candidates` 及旧解析函数):逻辑原样移入共享 `childproc.rs`,非功能删除(另修 `normalize_entry` 的 drive 斜杠条件,见上)。 - `nice.rs` 内联的 COMSPEC batch 拼装:改走共享 `build_child_command`,行为不变。 - 其余为新增(`childproc.rs`、`nohup.rs`、gate 新行),无产品功能删除。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#1488 wave4b — next 8 rust2 library-form commands + differential gates
8 commands implemented under the rust2 shape contract (explicit IO/env/cwd injection, no process globals, status returned not exited), each with >=20 gate cases (226 total) and a three-way differential gate (Rust driver / GNU coreutils 9.4 under WSL / C++ Debug dispatcher). Full 55-table suite green: 1335 GNU-gated + 190 win-gated, 0 fail. cargo test 420+16+5 green, cargo fmt clean.
Highlights
--random-sourcerow (37/40 strict). Observed-and-pinned exhaustion split: dry source mid-shuffle continues with identity draws; dry source in repeat errors "end of file".--random-seedstays the documented WinuxCmd extension (SHA3-256 + ChaCha12, byte-identical to the C++ DeterministicRng).-kkeeps them), BRE engine reuse (bre.rsgained leftmost-longest forward search). 32/32 strict.+optstring (LEADING options only:nohup true --bogusruns true;nohup --bogus truedies 125). Terminal faces (nohup.out, /dev/null stdin) are a documented deferral: console-ness cannot come through injected IO — wiring wave needs a driver-side probe.Shared infra (first commit)
childproc.rs: timeout's execvp-shaped resolver extracted so nohup shares it (timeout tests unchanged green).argopt:H_REJECT_SPEC/rejected_short_h— commands where GNU has no-h(getopt_long matches --help only as a long option; probed GNU 9.4).bre.rs: forward search (leftmost-longest) for csplit patterns.run-gate.sh: raw argv for Windows sides (MSYS_NO_PATHCONV=1) + the C++ package bin dir on PATH (the /usr/bin analog) for child-spawning parity; full suite re-verified green after the change. 14 wave1/wave2 TSVs regenerated to restore generator-backedness (committed tables had drifted from their definitions).Honest boundaries (documented in module docs + GATE-REPORT)
nohup console faces (wiring-wave driver probe), factor F7-class operand time, ptx circular-context/-G/-S/-W subset deviations, shuf infinite
-r(untestable in the bounded harness).Docs:
rust2/GATE-REPORT.mdWave4b section,rust2/gate/COVERAGE.mdaddendum,rust2/README.mdwave note. Not merged by this branch — review + product-side wiring follow REPLACEMENT-RECIPE.md.