Skip to content

WIP: fix(fd) — gate procsub argv-word marker delivery on consumer class (2225) - #2228

Merged
caomengxuan666 merged 3 commits into
masterfrom
fix/2225-procsub-argv-consumer-gate
Oct 30, 2026
Merged

caomengxuan666 merged 3 commits into
masterfrom
fix/2225-procsub-argv-consumer-gate

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Refs #2225 (pins the niu#720 / niu#723 console red to its cause; those close from the niu side once this lands and the console test turns green).

What

PR #2156 (for #1959) routed every procsub argv word through the #1903 fifo-marker rendezvous. A consumer that is not marker-aware opens the marker path plainly and reads the 7 !<fifo> bytes instead of the producer's stream — bisected by the niu-console-720-723 characterization cluster (rubash@3fb862ca drains to temp and a plain reader gets real bytes; rubash@6cd937ac hands the marker and the plain reader gets !<fifo>; niu CI went green→red exactly across the #2156 merge).

GNU subst.c:6362 process_substitute names a live pipe: any consumer opening the operand name must receive the producer's bytes. The marker is a private rendezvous, not a byte source, so it is now delivered only when the consumer is known to bridge it.

Gate

  • materialize_dev_fd_operands / dev_fd_table_operand now receive the consumer's resolved program path — threaded from all six spawn sites (external builtin + plain external in external_inner, comsub in command_substitution_values, pipeline stages incl. the internal-stage None mirror, proc_operands). The judgment eats the resolution result, never argv[0]'s spelling.
  • procsub_operand_delivery: marker delivery iff winuxcmd_fifo_marker_aware — the resolved program IS the WinuxCmd runtime binary: the tree's dispatcher, or an applet hardlink of the tree's winuxcmd.exe (is_winuxcmd_applet's identity test). Everything else — unknown, unresolved, plain copies, third-party flat packages inside the tree — falls to the pre-fix(fd): stream procsub argv words to external children via the #1903 fifo-marker rendezvous (rubash#1959) #2156 drain-to-temp: the miss direction is byte-correctness.
  • Deviation from the issue/REPORT sketch, flagged for review: the sketch said "path under the payload/home". Repo evidence (niubash#346 D6 refinement on posix_aware_child / is_winuxcmd_applet) shows membership alone overreaches — since WinuxCmd 1.4.0 the tree also ships third-party flat packages and shim forwarders with no bridging runtime, which would reproduce the same bug inside the tree. The identity criterion is exactly the set of programs running the bridging runtime; the predicate is a separate function from posix_aware_child because the contracts can drift independently.

Preserved faces: marker-aware consumers keep the #1959 streaming route (its pins untouched); redirect and builtin forms are untouched (they never took the marker arm); rubash itself as a consumer bridges markers in its own file layer and is unaffected either way.

Pins (issue2225)

  • src/executor/path.rs: issue2225_fifo_marker_aware_classification (Windows; dispatcher / hardlink applet / tree copy / third-party member / System32 / no-env routes).
  • src/executor/dev_fd_operands.rs: issue2225_procsub_operand_delivery_falls_to_drain (cross-platform; unresolved consumer ⇒ drain).
  • tests/regression.rs mod issue_2225 (Windows; executed by the goldens job): findstr and cmd /c type plain readers receive producer bytes (never !<fifo>), direct and in comsub; an applet-hardlink consumer (fake payload tree, GNU recho as the argv witness) receives the rubash-procsub-* marker word; a plain consumer and a copied tree member receive the rubash-devfd-* drained temp word.

…bash#2225)

Refs rubash#2225. Refs niubash#720, niubash#723.

#2156 sent every procsub argv word through the #1903 fifo-marker
rendezvous; a consumer that is not marker-aware (System32 findstr.exe
in niubash#720/#723) opens the marker path plainly and reads the 7
marker bytes instead of the producer's stream. GNU subst.c:6362
process_substitute names a live pipe whose bytes any consumer opening
the name must receive, so streaming may never change the bytes a
non-aware consumer reads.

materialize_dev_fd_operands now takes the spawn site's resolved
program path — threaded from execute_external, the env builtin, the
comsub fast path, both pipeline paths, and the exec operand plumbing
— and dev_fd_table_operand chooses the delivery per operand: the
marker rendezvous only when path::winuxcmd_fifo_marker_aware
classifies the consumer as the WinuxCmd runtime binary itself (the
dispatcher, or an applet hardlink of it; tree membership alone is not
awareness — the niubash#346 D6 class, whose third-party tree members
have no bridging runtime). Every other consumer takes the pre-#2156
drain-to-temp. The judgment eats the resolved path, never the argv[0]
spelling; every miss costs streaming, never bytes.

Pins: path::tests::issue2225_fifo_marker_aware_classification
(windows), dev_fd_operands::tests::
issue2225_procsub_operand_delivery_falls_to_drain.
Refs rubash#2225.

tests/issue2225_procsub_argv_consumer_gate.rs (windows-only):
findstr.exe and cmd.exe /c type — plain CreateFile readers that never
bridge markers — must receive the producer's bytes for a procsub argv
word, directly and inside a command substitution (on master both
print the 7 marker bytes instead). Word-shape pins observe the route
the gate chose through an argv-echo consumer built from the rubash
binary itself: an applet hardlink of a fake payload tree's
winuxcmd.exe receives the rubash-procsub-* marker operand; a consumer
outside any tree and a plain copy of an applet inside the tree
receive the rubash-devfd-* drained temp operand.
…ubash#2225)

The standalone target was compile-checked only; the same five pins now
live in mod issue_2225 inside tests/regression.rs, which the Windows
goldens job executes (cargo test --test regression). The word-shape
pins observe the route through the GNU suite's recho helper instead of
a rubash hardlink, so the fixtures are plain file copies in the
scratch dir.
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 30, 2026 14:10
@caomengxuan666
caomengxuan666 merged commit 1bb997a into master Oct 30, 2026
10 of 11 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/2225-procsub-argv-consumer-gate branch October 30, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant