Repository navigation
Strip the blank guard from in-process pipeline stage operands - #4171
caomengxuan666 merged 1 commit into
Conversation
An escaped blank (a\ b) lexes to ANSI_C_IFS_GUARD + blank. The cat pipeline arm and expand_pipeline_stage_arg_words expand their operands themselves and never stripped the guard, so with a DEBUG trap armed (oh-my-niu's preexec hook) `cat a\ b | wc -l` opened "a<U+E401> b" and failed with No such file or directory. Route the operands through one helper that drops CTLESC pairs and the guard, like command_prepare does for simple commands.
|
CAPTAIN-VERIFY — merged (head Mechanism, as verified. Two operand-materialization contracts disagreed: the simple-command path ( Fix shape. One helper, Evidence. CI: all functional legs pass; census unique names are only the three documented rotators (issue3949 amp-coproc, issue2771, issue2340 wait pair) — 0 unique true reds; goldens red is exactly the two pre-existing #4038 faces. Fail-first was re-run independently by the captain's lane on the pushed head: all 3 new pins green on the fixed tree; with only the src fix reverted (base pipeline_exec.rs restored, tests kept), the DEBUG-trap pin goes red with the exact field signature — |
Problem
Reported via niubash 1.5.1:
The failing operand is
a<U+E401> b: theANSI_C_IFS_GUARDcarrier that an escaped blank lexes to leaks into the file name.Cause
catas a pipeline stage runs in-process (PipelineSlot::Cat) and expands its operands itself. Together withexpand_pipeline_stage_arg_words(used by the echo/printf/tput arms) it only dropped CTLESC and never stripped the guard, unlikecommand_prepare::materialize_expanded_command_wordfor simple commands.It only shows up with a
DEBUGtrap armed (oh-my-niu installs one for its preexec hook); without a trap the pipeline takes a path that strips the guard.Fix
One helper,
unguard_pipeline_operand, drops CTLESC pairs and the guard; both sites use it.Tests
New
tests/pipeline_escaped_blank_operand_regressions.rs(pipe-driven-i). The DEBUG-trap test fails without the fix and passes with it; the other two are regression guards.cli_testshas the same 16 failures with and without this change.