Repository navigation
WIP: fix stage-context fd 3 delivery (Refs #2484) - #2519
Conversation
f32ddb5 to
2347a61
Compare
Two coupled defects in the bats_tee shape (a pipeline-stage function running exec 3<&1; tee >(cat >&3)): - dev-fd operand attach recorded raw parent descriptor numbers; the carrier handle systematically landed on the parent's lowest free fd (3 — the shell's fd 3 is virtual) and the child's ambient pin pass overwrote it with the stage pipe before the attach pass read it, so tee's /dev/fd operand bound the pipe instead of the carrier (doubled lines, empty carrier). Attach sources are now parked above the fd table's number range at record time. - A procsub consumer's dup'd Stdout-marker fd resolved through the process-stdout backing even when its dup record named the live capture scope, so its bytes never reached the stage output. The ambient adjudication now returns the capture scope's shared pipe write end for the live generation (ProcsubSpawnFd::CaptureWrite), the consumer registers as a capture writer, and the scope close drains its bytes into the capture — GNU's one-description merge for the process_substitute fork (subst.c:6362). New pins in tests/issue2484_stage_fd3_delivery.rs cover the stage-fn consumer, the verbatim bats_tee routing, the operand attach, and the final-stage-in-comsub face.
fef3663 to
081f86e
Compare
The input-procsub producer spawn's CaptureWrite arm pushed to ambient_pins without the #[cfg(unix)] gate its three sibling arms carry; ambient_pins itself is cfg(unix)-only, so the Windows build failed with E0425 (CI goldens + Windows compile check on 081f86e). Harvest fix by the captain; behavior on unix is unchanged. Refs #2484
|
[win-acceptance] #2519 PASS on the pinned/mini faces; one Windows platform residual flagged (pre-existing, not a regression) — pin Guards re-run x2 green this session on this tree: issue2212 14/14, issue2483 (pin unix-gated; live probe identical), issue2479 8/8, issue2502 6/6. Environment: Windows 10 19045 real machine, MSVC Rust debug build of master 9348b8d (= this PR's merge), oracle |
Refs #2484 — cluster C4.
Re-adjudicated on master b3ae3b8 (after the #2515 stage-0 rework and the #2516 streaming-sandwich path merged): the bats_tee cell still failed two coupled ways, both now fixed by mechanism:
Dev-fd operand attach clobber (
src/executor/dev_fd_operands.rs): the attach recorded raw parent descriptor numbers for/dev/fd/Noperands; the carrier handle systematically landed on the parent's lowest free fd (3 — the shell's fd 3 is virtual), and the child's ambient pin pass overwrote it with the stage pipe before the attach pass read it. tee's operand then bound the pipe (lines doubled downstream, carrier empty). Attach sources are now parked above the fd table's number range at record time (F_DUPFD_CLOEXEC), unreachable by pin targets and pin staging.Procsub consumer capture-blind backing (
src/executor/external_setup.rs,src/executor/trap_exec.rs): the consumer fork (GNU subst.c:6362 inherits the whole ambient table) resolved a dup'dStdout-marker fd through the process-stdout handle even when its rubash#223 dup record named the live capture scope. The adjudication now returns the capture scope's shared pipe write end for the live generation (newProcsubSpawnFd::CaptureWrite), the consumer registers as a capture writer, and the scope close drains its bytes into the capture buffer.Verification (captain re-runs): mini2212_t118 TAP byte-identical to GNU with rc 0/0; new pins
tests/issue2484_stage_fd3_delivery.rs4/4; guards issue2212 15/15, issue2483 6/6, issue2385 19/19, issue2479 8/8, issue2256 25/25, issue2502 6/6, issue2476 7/7 (all via scrubbed cargo). Residuals (ordering of consumer bytes vs the stage's own buffered writes; parked-generation records; consumer stdio ambient bindings; barewaitnot settling deferred consumers) are itemized in the cluster report.