Repository navigation
WIP: procsub operands: byte-correct drain by default, fifo-marker route behind proof key (Refs #2473) - #2485
Merged
Merged
Conversation
…e fifo-marker route (#2473) GNU assembles multi-operand process substitutions per occurrence: expand_word_internal calls process_substitute for EVERY `<(...)` word (subst.c:11364-11385), each with its own pipe (subst.c:6381) under its own /dev/fd name (move_to_high_fd + make_dev_fd_filename, subst.c:6392-6394, add_fifo_list 6343) — the contract for every operand being that whatever consumer opens the name receives the producer's bytes. rubash#2225 gated the Windows fifo-marker streaming route on binary identity ("the consumer IS the WinuxCmd runtime, so its reads bridge markers"). Measured against the installed WinuxCmd 1.1.20 the prediction is false on the READ side: paste/wc/od/comm/diff read the 7 `!<fifo>` marker bytes plainly (`paste <(echo 1) <(echo x)` printed `!<fifo>\t!<fifo>`, `wc -c <(printf hello)` counted 7), and WinuxCmd's own runtime does not rendezvous with its own mkfifo marker — its `od` reads the marker bytes immediately while the writer blocks in the pipe open (unixwin/WinuxCmd#1493). A wrong identity prediction here is silent operand byte corruption, the exact harm #2225 was written to prevent, so identity is no longer treated as proof. The delivery gate now inverts admission: every consumer takes the byte-correct drain (the pre-#2156 shape) unless the machine-level RUBASH_PROCSUB_FIFO_MARKER=1 key asserts the installed runtime bridges marker reads — the #1959 streaming route stays armed behind that key (pinned end-to-end: with the key a non-bridging reader sees the marker path while rubash's own bridging cat still streams the bytes through the rendezvous). The identity classification itself is unchanged (path::winuxcmd_fifo_marker_aware and its pins stand). Pins (tests/issue2473_procsub_operand_marker_regressions.rs, #![cfg(windows)]): deterministic end-to-end tests build an aware-class stand-in consumer by hard-linking the rubash binary under a fake WinuxCmd tree (winuxcmd.exe + paste.exe) and invoking it as `paste -c 'cat "$0"'` — one/two/three operands carry their own bytes, the proof key flips the delivery, the key never reaches non-runtime consumers, and the single-operand internal face is unchanged; plus real-WinuxCmd pins (paste 2/3-operand, wc byte count, comm columns, diff actually seeing the difference) that skip when the runtime is absent. Unit pin updated: dispatcher-class consumer drains without the key, marker-routes with it. Verification: WSL GNU Bash 5.3.20 vs the fixed Windows binary, script-file byte-compare — stdout/stderr/rc identical for the issue reproducer plus paste 3-operand, wc count, comm, diff, single-operand cat (artifacts under target/issue-suites/results/issue2473/). cargo test --lib: WSL 1029/0; Windows 1123 passed with 2 failures both identical on pristine origin/master (environment-bound). Neighboring procsub family green except the master-reds already documented in #2472 (issue1959 abandoned-producer et al). Refs #2473 See-also: unixwin/WinuxCmd#1493
caomengxuan666
force-pushed
the
fix/2473-procsub-multi-operand
branch
from
November 2, 2026 00:40
e2479a4 to
8403ebd
Compare
caomengxuan666
marked this pull request as ready for review
November 2, 2026 00:40
…t route issue2225_aware_applet_consumer_gets_marker_operand simulated a marker-aware consumer by file identity alone. #2473 changed the contract: file identity is no longer proof (shipped applets read the marker bytes as plain content), so the streaming route additionally requires the runtime's RUBASH_PROCSUB_FIFO_MARKER=1 proof key. The pin now exports the key the way a proven runtime does; the unproven default stays covered by the drained-operand pins and the falls_to_drain unit test. Coordinator harvest fix on top of the author's commit. Refs #2473
Member
Author
|
[win-acceptance] #2485 PASS — new pin 7/7 x2 @--test-threads=4; issue #2473 repro shapes byte-identical to WSL GNU Bash 5.3.20: Environment: Windows 10 19045 real machine, MSVC Rust debug build of master 103c6a0 (= this PR's merge step), GNU oracle = Family battery at -j4: issue1021 1/1, issue1220 2/2, issue1223 3/3, issue1336 5/5, issue1460 1/1, issue1959_procsub_argv_streaming 6/6 — all green. No BLOCKER. |
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.
Summary
paste <(echo 1) <(echo x)handed the command the literal!<fifo>marker bytes (!<fifo>\t!<fifo>; GNU1\tx). Root cause is NOT multi-operand assembly — every external WinuxCmd-runtime consumer got marker bytes (paste/wc/od/comm/diff, single operand alike;cat <(echo one)only looked green because rubash'scatis internal). The #2225 delivery gate trusted binary identity ("the WinuxCmd runtime bridges!<fifo>markers on read") as proof — measured against the installed WinuxCmd 1.1.20 that prediction is false on the read side, and its failure is silent operand byte corruption.GNU basis (vendored third_party/bash)
subst.c:11364-11385—expand_word_internal's</>arm: EVERY<(...)occurrence gets its ownprocess_substitutecall (per-operand assembly; N operands → N substitutions).subst.c:6381pipe()per substitution;subst.c:6392-6394move_to_high_fd+make_dev_fd_filename(+add_fifo_list6343) — each operand a distinct live pipe under its own/dev/fd/Nname;subst.c:6412make_child(FORK_ASYNC|FORK_PROCSUB)forks the body.Evidence chain
1c93ea87(standalone Windows build):paste <(echo 1) <(echo x)→!<fifo>\t!<fifo>;wc -c <(printf hello)→ 7 (the marker's byte count);od -c <(printf hello)→ the 7 marker bytes.mkfifo+od—odreads the marker bytes immediately instead of blocking in the rendezvous, while the writer correctly blocks in the pipe open ⇒ the runtime's applet READ path does not bridge markers. Filed as applet 读路径不桥接 !<fifo> marker(od 读自家 mkfifo 产物得 7 字节字面量,写侧正常阻塞) WinuxCmd#1493.cat.exe <(echo early; sleep 3; echo late)emittedearlyonly at +3117ms — every previously "green" case was actually the byte-correct drain, never a working bridge.Change (src/executor/dev_fd_operands.rs)
procsub_operand_deliveryinverts admission: identity class is no longer proof. Every consumer takes the byte-correct drain (the pre-#2156 shape) unless the machine-level keyRUBASH_PROCSUB_FIFO_MARKER=1asserts the installed runtime bridges marker reads — the #1959 streaming route stays armed behind that key (a future version probe can replace the manual key once a bridging WinuxCmd release exists). The identity classifierwinuxcmd_fifo_marker_awareand its pins are unchanged. This is the #2225 invariant applied to itself: a miss costs streaming, never bytes.Pins (tests/issue2473_procsub_operand_marker_regressions.rs, #![cfg(windows)])
winuxcmd.exe+paste.exe) invoked aspaste -c 'cat "$0"'— 1/2/3 operands each carry their own producer bytes; with the proof key a non-bridging reader (cmd /c type) sees the marker path while rubash's own bridging cat still streams through the live rendezvous; the key never reaches non-runtime consumers (findstr); single-operand internal face unchanged.pastereproducer,wc -cbyte count (5, not 7),commcommon-column shape (two tabs),diff <(echo a) <(echo b)actually seeing the difference (pre-fix two identical markers made it report no difference — silent wrong data).Verification
target/issue-suites/results/issue2473/.cargo test --test issue2473_procsub_operand_marker_regressions— 7/7 (stand-in default test red on master:paste <(echo one)→!<fifo>).cargo test --lib— WSL 1029/0; Windows 1123 passed / 2 failed, both failures byte-identical on pristine origin/master (environment-bound).cargo check --tests(the Windows CI lane command) clean. Neighboring procsub family green except the master-reds already documented in WIP: procsub: inherit ambient exec fds in the <(...) producer fork (Refs #2466) #2472.Machine info
Windows 10 10.0.19045 x64; standalone master binary
D:\capon-build\dlm-target\debug\rubash.exe(1c93ea8) for reproduction; worktree build in an isolated target dir; WSL GNU Bash 5.3.20 (/usr/local/bin/bash).Notes
Refs #2473
See-also: unixwin/WinuxCmd#1493