Repository navigation
operator values: dequote stored CTLNUL + quoted-null retention oracle for @-lists - #3755
Conversation
GNU carries the whole alternate of ${param-OPword} as ONE word
(subst.c:7840-7860 param_expand feeds the rhs through the ordinary word
machinery): `${0+ "$@" }` is affix ` ` + `"$@"` + affix ` `, so the
whitespace around and between the fragment's words glues to the
boundary fields and expand_word_list_internal splits only unquoted-IFS
-whitespace runs of the assembled result.
expand_alternate_word_fragment re-lexed the fragment as
`__rubash_parameter_alternate__ <fragment>`, and the lexer dropped the
inter-word whitespace: ` "$@" ` tokenized to a bare `"$@"`, yielding
`<a b>`/`<c>` where GNU yields ` < a b>`/` <c >` under IFS='' or a
non-whitespace IFS (dollar-at-star9.sub ${0+ "$@" } family).
Recover each separator as the source gap between consecutive word raws
and merge fields across word boundaries: a separator byte is a field
delimiter only when it is ambient-IFS whitespace (unset IFS: space/
tab/newline; set IFS: its whitespace members); inside a double-quoted
outer word every separator is literal text.
Verified byte-for-byte against GNU Bash 5.3.20 (probe /tmp/probe_final.sh):
default IFS unchanged, IFS='' and IFS=':' glue edges to $@ boundary
fields, empty-expanding words glue through, double-quoted outer words
never split. Gate sweep of 101 dollar/quote/posixexp/array .sub files:
dollar-at-star9 18 -> 6 residual lines, zero regressions elsewhere.
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ubash#3605) GNU parameter_brace_expand_rhs (subst.c:8096-8173) returns the =/:= result via dequote_string(temp) then quote_escapes/quote_string (subst.c:8172): an embedded CTLNUL is protected as field-internal DATA, and W_HASQUOTEDNULL is forgotten whenever the word is not exactly one CTLNUL (subst.c:8174-8179). The -/:- value side returns the stored parameter text verbatim (subst.c:8090 w->word = temp). A CTLNUL byte sitting in a bound variable's value therefore dequotes to nothing and drops the empty field -- it never anchors <> -- while a marker freshly emitted by the current word's own RHS expansion keeps its anchoring provenance. rubash returned the bound ' QUOTED_NULL_MARKER ' verbatim from the =/:= arms (parameter_words.rs routed body + expand_braced_ops &self chain) and from the -/:- value arms, leaking the raw U+E002 byte into argv or anchoring a spurious empty arg where GNU yields zero args. dequote_assignment_operator_result (parameter_words.rs) runs the E400-aware restore_bare_sentinels with QUOTED_NULL_MARKER -> '' on the value side of all six arms; RHS expansion results are untouched, so unset -/:- and set + keep their quoted-null semantics. Pins in tests/issue3605_operator_value_ctlnul.rs; byte-verified against GNU Bash 5.3.20 (/opt/homebrew/bin/bash). Residual (documented in test): the RHS-emitted quoted empty "$@" segment should glue to neighbouring fields (GNU M...N -> MN) -- the missing-<>/empty-arg-glue family on the emission side, next. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…#3605) Follow-through on the stored-value dequote invariant: the plain $name splice in the embedded-parameter walker (embedded_mutations.rs is_shell_ name_start arm) read a bound ' QUOTED_NULL_MARKER ' verbatim, so `S $n T` emitted a spurious anchored empty arg where GNU drops it (subst.c:8090 verbatim value read + remove_quoted_nulls at field assembly). The helper is renamed dequote_stored_parameter_value since it now covers every stored-value read site, not just operator results. Byte-verified vs GNU 5.3.20: S $n T -> S,T; "$n" -> ' '; A$n""B; quoted :- read. Remaining residual unchanged: RHS empty-arg glue family. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…bash#3605)
The rhs of a has_dollar_at operator word (`${param OP word}`) kept
splitting element-internal whitespace and joining element boundaries
on a bare ' ' regardless of IFS.
GNU model (subst.c):
- :12095-12101 string_list_dollar_at separates the positional
parameters with $IFS[0]; :12114-12153 expand_word_internal then
field-splits the assembled rhs word.
- :2975-3000 string_list_dollar_at: PF_ASSIGNRHS forces sep ' ',
else ifs&&*ifs -> ifs_firstc, else ' ' (a set-but-empty IFS still
joins `@` on ' ').
- :2902-2930 string_list_dollar_star uses ifs_firstchar (:2864):
a set-but-empty IFS returns a zero-length separator so `$*`
elements concatenate.
Port:
- embedded_mutations.rs / embedded_parameters.rs `@` and `*` arms:
mark each element's whitespace per-element (mark_expansion_whitespace
/ mark_alternate_whitespace on protect_rhs_value|protect_result_backslashes
output) and join with the GNU separator above instead of wholesale
join(" ") + optional marking. `*` arms take ifs_firstchar semantics
(IFS='' -> ""); `@` arms add the PF_ASSIGNRHS -> ' ' branch using
inside_assignment_rhs || ASSIGNMENT_RHS.
- parameter_words.rs expand_parameter_word /
expand_alternate_parameter_word: when the rhs word is has_dollar_at
and not inside_assignment_rhs, run the expanded result through
rhs_expansion_has_dollar_at + split_operator_rhs_fields — a glue-
preserving field splitter modelling subst.c:12145
(`list_string(istring, *ifs_chars ? ifs_chars : " ", 1)`) — and
rejoin on IFS[0]. IFS_GLUE pairs survive as data so `q r` stays one
field while `:` boundaries split.
Verified byte-identical against GNU bash 5.3.20 (script-file probes):
`A${q- "$@" }B` -> `Ap` `q r` `rB`; IFS=':' -> `A p` `q r` `r B`;
`x=${q- "$@" }` stores ` p q r r `; IFS='' `set -- '' ''`
`recho ${v= "$*" }` -> ` `; `IFS='' x=$*` -> `ab`; IFS=':'
`v=${v- "$@"}` stores `a b`.
Gate run-dollars: dollar-at-star9 21 -> 15, dollar-at-star8 8 -> 4;
remaining diffs belong to the already-documented carrier-leak and
`<>`-anchor families. marker-lint clean, 4 new pin tests +
alternates/separator regressions green.
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…bash#3605)
Fix two bugs in the <>-anchor family, both caused by the cooked word
losing quote bytes the lexer stripped:
- Re-split gates (word_is_unquoted_positional_*_list_expansion and
word_is_unquoted_array_list_expansion) checked the COOKED word, so
''"${@/*}" / ''"${a[@]}" — which cook to ${@/*} / ${a[@]} — were
misread as unquoted and re-split into zero fields. Gate on
raw_word_is_quoted(raw) instead: GNU field-splits an expansion's
elements only on the unquoted path (expand_word_internal sets
Q_DOUBLE_QUOTES and never splits, subst.c:11229).
- raw_quoted_at_word_has_quoted_null over-required a quoted/unquoted
$@-recognition flag; GNU's all-empty discard branch is
`had_quoted_null || (quoted_dollar_at == 0 && PARTIALLY_QUOTED)`
(subst.c:12026-12035) — had_quoted_null ALONE retains an empty
argument, so ''"${a[@]}", ""${@/*} and "$x""${@#p}" (x unset) all
keep <>. Drop the saw_quoted_at arms; the '' / "" / $'' / quoted
pure-empty-reference spans suffice (11841-11847 / 11940-11944).
- for-list path (command_words.rs) gains the same retention:
`for i in ''"${a[@]}"` iterates once with i=''.
Verification (GNU Bash 5.3.20 /opt/homebrew/bin/bash, script-file
probes): full matrix incl. set-empty-scalar a='' cases byte-identical;
dollar-at7 0 diffs; pin 4/4; separators pin 4/4; adjacent array/quoting
pins 29/29. Residual run-dollars diffs are separate known families.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
field_split_values_with_ifs early-returns the verbatim value when IFS
is empty — correct that no splitting runs (GNU expand_word_list_internal
subst.c:13219 skips word_split), but wrong that the value keeps its
protection pairs: GNU still runs the final dequote (subst.c:4807
dequote_string) whether or not splitting happened, and IFS_GLUE /
ANSI_C_IFS_GUARD pairs exist precisely so a running splitter can
consume them. When the splitter is skipped nothing removed them, so
`IFS=''; X='X Y'; recho ${0+ "$X" }` leaked the \x1c glue byte into
the emitted argument (` X\x1c Y ` instead of ` X Y `).
Strip both marker families in the empty-IFS arm, mirroring
strip_ifs_protection_markers (command_prepare.rs) which does the same
for every other non-field-split return path.
Verified byte-for-byte vs GNU Bash 5.3.20: the bisected gate command,
an IFS='' matrix covering $'...' decoded blanks / ${v- "$@" } /
unset-IFS fallback, and a custom-IFS guard matrix. run-dollars
dollar-at-star9 15 -> 13, no suite gained diffs. Pin:
empty_ifs_still_strips_protection_glue (GNU-verified expectations).
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…rubash#3605)
`export`/`readonly`/`declare`/`typeset`/`local` operands whose raw
token is assignment-shaped carry W_ASSIGNMENT (general.c:480
assignment()) and expand with PF_ASSIGNRHS. That flag both disables
field splitting — command_words.rs already keeps such operands unsplit
— and switches the "$@"/"${@}" element separator to ' '
(string_list_dollar_at tests PF_ASSIGNRHS first, subst.c:2975-3000:
"make sure positional parameters are separated with a space even when
word splitting will not occur").
The embedded `$@` arm joined element boundaries with IFS[0] whenever
inside_assignment_rhs was unset, so `typeset t="x$@y"` under IFS=,
bound `xa,x,b yy` where GNU binds `xa,x b yy` (dollar-at-star8 a1/a2
family: `"${a[@]} ${a[*]} $@ $* ${@} ${*}"` produced `a,b,c` for the
bare `$@` slot). expand_command_word now sets inside_assignment_rhs
for the duration of expansion when the command word is a
declaration-builtin assignment operand, mirroring GNU's flag.
Verified byte-for-byte against GNU Bash 5.3.20 (script-file probes):
typeset/export/readonly/local × quoted/unquoted `$@`/`${@}`/`$*`/`${*}`
× affixed words, plus plain `v="$@"` unaffected; gate dollar-at-star8
8→0 diffs with zero regressions across the dollar-* family.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
GNU parameter_brace_expand_rhs dequotes the rhs before bind_variable
(subst.c:8096-8173, dequote_string at :8151): a quoted-empty rhs span
emits QUOTED_NULL_MARKER (U+E002), which NOSPLIT2 drops from the
ASSIGNRHS result list (subst.c:11853/11921), so the variable cell never
holds the sentinel. The alternate-rhs walk was storing the decoded
string verbatim, so after `recho ${v= ''}` the cell kept the marker
byte and `recho $v` later emitted it raw (dollar-star10 family).
Both the `:=` and `=` arms of apply_parameter_assignment_expansion_
with_context now pass the bind value through dequote_stored_parameter_
value (E400-aware restore_bare_sentinels), the same contract used by
the other stored-value consumers (S $n T splice arm).
Verified byte-identical vs GNU Bash 5.3.20 across `${v= ''}`, `${v=''}`,
`${v= $*}`, `${v=$* }`, `IFS=''` and unset-IFS variants. Gate replay:
run-dollars/dollar-star10.sub 8 diff lines -> 0; run-dollars family
residual 41 -> 33 (remaining families pre-existing: at-star10 \x7f
carrier, at-star3 unset-IFS boundary, at-star5 exit code, at-star9
\x7f/^ carriers, star7, star9).
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…eep quote state (#3605 star9) Two couplings for dollar-star9's remaining ${var-<mod>} family, byte- verified against GNU 5.3.20 (/opt/homebrew/bin/bash, patchlevel 20): 1. Every modified `*` form — pattern removal `${*/1/X}`, case mod `${*,,}`, and transforms `${*@q}`/`${*@A}` — joined its elements with a hardcoded ' ' (or a Posix-888 ' ' fallback under empty IFS). GNU string_list_pos_params (subst.c:3030-3057) routes `*` through string_list_dollar_star, whose separator is ifs_firstchar (subst.c:2864, empty string when IFS is set empty); the dollar_at ' ' fallback applies only to the UNQUOTED expansion. The three string producers (expand_parameter_pattern_removal @|* arm, expand_braced_transform_parameter, expand_braced_case_parameter) and the Vec producer (positional_transform_word_values quoted `*` arm) now join via positional_transform_separator / ifs_first_char_separator. 2. Synthetic quoted alternates lost their quote state: `quoted_positional_at_word_values_with_raw` saw the cooked word `${*:1}` (no leading `"`, no STORAGE_WORD_PREFIX) and ran the unquoted re-splitter, so `"${var-${*:1}}"` yielded two fields where GNU yields `12`. param_expand propagates `quoted` into the operator word (subst.c:7840-7860); the raw hint now delegates to the quoted walker when the raw word is wrapped in `"..."` and the cooked word lost the marker. The for-list/word-list admission in braced_alternate_word_values is broadened to `${@`/`${*` alternates for the same reason. Verification: /tmp/s9_q2.sh + /tmp/s9_wide.sh (18-case modified-form matrix) byte-identical to GNU 5.3.20; gate run-dollars dollar-star9.sub 9 -> 0, star9/star10/at-star8 all 0; dollar-* total 36 -> 11 (residual: at-star10 \x7f carriers 3, at-star3 1, at-star5 1, at-star9 5, star7 2 — separate families). New pin star_modified_forms_join_on_ifs_first_char; adjacent pins (ifs_separators 8/8, operator_value_ctlnul 7/7, quoted_null_anchor 8/8, alternate_fragment_separators 4/4) all green; fmt + marker-lint clean. Refs #3605 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Replace the ad-hoc "is the word quoted" retention checks with a scan of
the raw word mirroring subst.c:12026-12052 param_expand(): keep one empty
field iff had_quoted_null, or (quoted_dollar_at == 0 && partially quoted).
raw_empty_word_keeps_field() walks the raw word like read_token_word:
- '' / "" / $'' literal-empty pairs -> had_quoted_null
- "..." spans are classified by quoted_span_at_list: a word-level $@,
${@...}, or ${name[@]...} whose LIST expands empty -> quoted_dollar_at
(drop); anything else inside the span -> had_quoted_null (keep). This
reproduces chk_atstar being called only by the operator families that
expand the @-list: bare/slice/pattern ops (AtOperator::List) and the
`+` set-check on a SET array (subst.c:9717-9725 chk_atstar), while
`-`/`=`/`?` produce a scalar (had_quoted_null) and `+` on an UNSET
array yields the scalar '' (had_quoted_null).
- ${...} / $(...) / backtick bodies are skipped depth-aware so quotes
inside their operands (${v= ''}) don't masquerade as word-level
quoting and nested $@ (${foo=$@}) doesn't count as word-level.
The gate is applied at every empty-expanded-word tail: the generic
expand_command_word tail, the embedded-fragment arm, and
empty_expanded_word_keeps_field keeps the metadata fallback for words
with no raw.
Verified byte-for-byte vs GNU bash 5.3.20 (23-case n() matrix + 14-case
@/[@] operator matrix + 451-file old-vs-new sweep: only fixes, zero
regressions): dollar-at-star5 and dollar-at-star10 now 0 diff.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Refs #3605. `"123 $@\ 456"` collapsed into one field ("123 abc def ghi\ 456") because three layers declined on any `\` inside a double-quoted body: - `quoted_body_positional_at_segments` returned None on `\` - `push_body_piece` refused pieces containing `\` - the literal pushers (`push_quoted_span_segment` / `push_quoted_positional_literal_segment`) refused `\` and `` ` `` GNU's rule inside `"..."` is that `\` only escapes `$`, `` ` ``, `"`, `\`, and newline (parse.y read_token_word CBSDQUOTE table); `\ ` is literal backslash-space. So `\ ` must reach the literal piece verbatim, `\$` must not read as a positional source, and the piece text must be cooked with the dquote escape table rather than generic dequoting: - The body scanner's `\\` arm now skips the escapee (`index += 2`) so a `\$@`/`\"` never desyncs the segment scan. - `push_body_piece` keeps backtick declines (the inner parse owns them) but cooks every piece with `cook_double_quoted_segment` — the same table the lexer uses for dquote bodies — so `\$`/`\"`/`\\`/`\`` become their DATA_* carriers and a non-escape `\ ` stays literal. This is the cooked representation the downstream expander already understands (whole-word `"a\ b"` produces `a\\ b` in the cooked stream). Verified against GNU bash 5.3.20(1)-release (script-file probes, byte-for-byte): `"123 $@\ 456"`, `"x$@\ y"`, `"x$@\\y"`, `"x\$@y$@"`, `"pre\$not$@post"`, `"x\\$@y"`, `"x\"$@y"`, `"a\ b"`/`"a\$b"`/`"a\\b"`/`"a\"b"` — all identical. Gate replay: dollar-at-star3.sub now 0 diffs (was 4); remaining dollar-* diffs are the documented dollar-star7 (mid-word IFS assignment) and dollar-at-star9 (in-band \x7f/^^ carrier) families. Pin tests issue3605_quoted_null_anchor (4) and issue3605_dollar_at_star_ifs_separators (8) pass. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…d $* (#3605) Ports two GNU mechanisms that govern unquoted $*/${*} under set-null IFS: - W_SPLITSPACE (command.h:79): pieces produced by unquoted $*/${*} under a set-null IFS carry a "split this word on spaces" mark (subst.c:10665-10668), which accumulates to the word and forces the final split to run on " " (or " \t\n" when IFS is unset) regardless of a later mid-word IFS bind (subst.c:11535, 12103-12107). Ported as SPLIT_ON_SPACES_SENTINEL (PUA E31C, registry-const per rubash#2885 E8) emitted by the "${*}" producer (expand_braced_special) and honored in field_split_values_with_ifs (arrays.rs) plus strip_ifs_protection_markers (command_prepare.rs). - expand_no_split_dollar_star (subst.c:237): pattern words and other no-split contexts take string_list_dollar_star (concat join) instead of dollar_at+W_SPLITSPACE (subst.c:3048, 4470-4530, 10653-10675). Ported as a NO_SPLIT_DOLLAR_STAR thread_local (expand_braced_replacement.rs) set for ${paramOPword} pattern RHS (parameter_patterns.rs), consumed by the embedded $*/$@ arms (embedded_parameters.rs, embedded_mutations.rs) and the "${*}" arm, restoring ${x#$*}/${x%$*} under IFS='' and fixing the at-star4 regression the sentinel introduced. Verified byte-for-byte vs GNU bash 5.3.20(1) on the dollar-* suite matrix: star4/star5 regressions cleared, dollar-star7 8->2 residual lines (one remaining piece-protection interaction documented on #3605). Full dollar-* replay: 27/29 pass; residual fails are the recorded at-star9 \x7f carrier family (deferred on #3605) and star7 line 4. Adjacent-suite sample (glob2/nquote4/new-exp1/posixexp2/vredir6/read2/ heredoc3/printf2): all diffs are pre-existing environment differences (error line numbers, /dev/tty wording, locale, $0 path), none in the $*/$@ class. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
#3605) GNU expand_word_internal (subst.c:11229) is a single left-to-right pass: a mid-word `${IFS=}`/`${IFS:=-}` bind takes effect at its fragment's position, so earlier fragments render against the pre-bind IFS. The assignment pre-scan hoists every bind ahead of the render pass, which made all ${*}/${@} pieces of `${*}${IFS=}${*}${IFS:=-}"${*}"` see the FINAL IFS value (dollar-star7.sub). - parameter_words.rs: extend the rubash#1169 pre-scan freeze to IFS-dependent fragments — `${*}`/`${@}` subjects, `name[@]`/`name[*]` list subscripts, and nested bare `$*`/`$@`/`${*}`/`${@}` — when the assignment target is IFS (fragment_depends_on_ifs). Each piece now renders under the IFS GNU shows it: unset for piece 1, set-null for piece 2, `-` for the quoted tail. - embedded_{mutations,parameters}.rs: when the assembled word carries SPLIT_ON_SPACES_SENTINEL (the W_SPLITSPACE port), the lazy quoted-site span protection adds ' ' to the protected set — a quoted span's whitespace is CTLESC-protected data in GNU and must survive the split-on-" " pass (subst.c:11535 → 12103-12107). Scoped to the sentinel path; non-sentinel words keep the exact prior marking. Verified byte-for-byte vs GNU bash 5.3.20(1): the full dollar-* suite is now 28/29 (only the recorded at-star9 \x7f carrier family deferred on #3605); dollar-star7 8->0, dollar-star11/4/6/9, dollar-at-star2/8/10, dollar-at7 all cleared. Full 451-file run-dollars replay: no pass->fail regressions attributable to this change (the unicode2 delta is an environment-masked helper-file artifact, verified by comparing the pre-change outputs). New pin: tests/issue3605_star7_splitspace_ifs_regressions.rs (4 cases). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…bind (#3605) GNU shell.c:1604-1620 rebinds dollar_vars[0] to the spelled script name right after open(2) succeeds, so diagnostics issued past that point carry the script's own name as the prolog (error.c:74-117 internal_error). Verified byte-for-byte vs GNU bash 5.3.20: - `bash /tmp` -> /tmp: /tmp: Is a directory - `bash /bin/ls` -> /bin/ls: /bin/ls: cannot execute binary file - PATH-found operands print the resolved path in the second slot (shell.c:1595-1597 filename -> path_filename). Open-time failures (EACCES, ENOENT) still use the shell's own name since the rebind has not happened yet. Refs #3605 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
GNU parameter_brace_expand_word (subst.c:7663) hands the word half of
`${var op word}` back to expand_word_internal, whose scan owns the
`<`/`>` process-substitution cases (subst.c:11365-11385). An unquoted
`<(`/`>(` in the alternative's own text therefore materializes when —
and only when — the arm that expands it is taken:
cat ${foo:-<(echo a)} -> reads /dev/fd/N
cat ${foo+<(echo G)} -> reads /dev/fd/N (was literal)
${u:=<(echo H)} -> binds u=/dev/fd/N (was literal)
Three places modeled that scan incompletely:
- expand_embedded_parameters_alternate_mut is the funnel every
operator-word expansion in the mutable path goes through (routed
`:-`/`+`/`=`/`:=`/`?` arms via expand_operator_rhs_for_context, the
braced_alternate_word_values argv fast path via
expand_alternate_parameter_word). Materialize the word's own unquoted
procsub spans there first. The materializer's quote-aware scan keeps
`"<(` and `\<(` literal (subst.c:11369 Q_DOUBLE_QUOTES), and a `<(`
arriving from a variable's value is appended as expansion output
below, never re-scanned — matching GNU appending values verbatim.
- A `${...}` fragment embedded in a larger word (`9:${foo+<(G)}`) fell
back to the &self expand_word, which can never spawn a substitution
child. Route words containing `${` plus procsub-shaped text to the
mutable walker, the same reason `$(`/backtick words take it
(parameter_core.rs expand_word_mut_with_context).
- `"${unsetv:-<(echo D)}"` must stay literal: param_expand passes
`quoted` into the alternate's re-expansion (subst.c:7840-7860). The
`${` fragment arm now propagates its quoted-site state (in_double or
a QUOTED_EXPANSION_SITE marker just consumed) as DoubleQuoted context
for the fragment resolver, so the procsub cases are skipped inside
double quotes.
Separately, the assignment-RHS cooked rescan
(rhs_has_procsub_text in expand_assignment_value_inner) now requires
raw_word_has_unquoted_process_substitution so value-borne `<(` text —
`y=${x:-<(echo b)}` with x already holding `<(echo a)` — stays data.
Verification: 14-case arg/assign x `:-`/`+`/`:=`/`>` x
set/unset/quoted/value-borne/nested matrix byte-for-byte vs GNU
5.3.20; run-new-exp loses the procsub hunks (remaining diffs are the
recorded shell-name, bad-substitution-payload, and unbound-variable
residuals); new pin issue3605_alternate_procsub_materialization 8/8;
adjacent exp-tests/dollars/posixexp2 diffs unchanged (recorded
environmental and deferred CTLNUL families).
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
GNU parse.y:4173 hands a nested `$(` span to parse_comsub atomically —
its `)` owns the inner substitution and is never a token of the
enclosing case machinery. Both comsub-body verbatim scanners fed the
nested span's interior to the case word machine instead:
- src/parser/command_substitution.rs dollar_command_substitution: the
recursive `$(` skip was gated behind `double`, so an unquoted nested
`$(` inside a case fed `l`,`s` as subject-word chars; the inner `)`
then hit the rubash#2789 glued-paren close predicate
(`case_in_stage == 2 && !region_before && !word_before.is_empty()`)
and truncated the body at `case $(ls` — `$(case $(ls) in *) ok;; esac)`
errored at the trailing `)` (run-comsub-posix family).
- src/executor/command_prepare.rs copy_comsub_body_verbatim_for_ifs_
marking: the `'$'` arm bumped paren depth but the inner `)` was
gated behind `case_depth == 0`, so depth never balanced inside a
case and the copy overran the substitution end.
Both now skip the nested span opaquely (recursion / the same verbatim
copy) and feed `\u{1}` — the `\\` arm's word-unit placeholder — so a
`$(...)` case subject still completes `case WORD` for the `in` arm.
Verified vs GNU 5.3.20 byte-for-byte on a 20-case matrix (case
subjects `$(ls)`/`$((n))`/`${v}`/mid-word/nested-case, `$(` in
pattern/body/if/for position, backtick wrap) plus an IFS-marking
matrix; gate run-comsub-posix diff 29 -> 26 lines (remaining hunks
are error-token wording on malformed inputs, same pre-existing
family); run-comsub/comsub-eof/case/casemod clean; run-comsub2 diff
identical to pre-existing alias-ordering log. Pin test
keeps_comsub_case_subject 9/9 in case_reclassification_tests.
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
【WIN-AGENT-AUDIT】s2 PR #3755 第1轮 — 建议:PENDING(跳过,未合并、未关 #3605) 跳过原因(规程 1.4 + 1.15):
未跑/VOID 的腿:全部(钉自跑、fail-first、lib 双边、warnings、fmt/卫生、CI 逐格、GNU 对照)—— 原因:以上两条阻塞,且 head 移动中,跑出的数字在下一个 push 后即失效。 给队长的建议:等 #3754 返工(F1/F2)落地、且该分支 24h 内无新 push 后,重新派 lane 全审;届时重点核 合并:无(PENDING) |
|
【WIN-AGENT-AUDIT】PR #3755 第2轮 — 建议:PENDING(维持 s2 跳过结论;栈底未落地) T 波复核(收尾波,分工 t4):
未跑/VOID 的腿:全部(同 s2,原因:栈底 FAIL + 目标分支未定)。 |
|
【WIN-AGENT-AUDIT】u3 批次汇总(10 PR 全审完)
续作推送(均非 force,推前已核远端 head 未变):#3723→4075d34fb、#3734→2ae1e1373+bd060f876、#3737→2ad2400e4、#3718→c4e1e75d2+358488ae6。 方法论备注:Windows 仿真 fd table 会让 fd-save/restore 类钉假绿——#3723/#3737 的「base 绿」在 Windows 成立但 Linux merge-base 上 8/5 枚真红;本批 fd 族结论均以 WSL Linux 原生构建(rustup 1.99.0)为准。 |
|
【o1 收网判词:PENDING(语义冲突,未合并)】head 本 PR 自述「stacked on #3754」,但 #3754 在合入前经历 fb1422f/90a9b90b9 返工(最终 squash 为 master 冲突清单:
覆盖度抽查(把本 PR 的 5 个新钉原样放到 master
需要的后续(建议由作者/队长派工):以 |
|
【o1 收网】判词 PENDING(语义冲突,栈底返工未落) — 本 PR 未合并、未 push 新 commit,分支保持 背景:#3754 已于本轮合入 master(squash 我实际执行了两侧解析并实测(worktree
两侧都不能单独成立,正确解法是把本 PR 的 3 个特性族移植到 #3754 新机制之上(不是文本合并):
这属语义裁定+重写,按 lane 规程「语义冲突 abort 并报告」处理:未合并、未改分支、未关任何 issue(#3605 伞目录保持 OPEN)。 未跑腿:合并版 lib 双边 / warnings / fmt / GNU 矩阵(在 11 格红定案后未继续消耗构建)。 |
|
【WIN-AGENT-AUDIT】o1 续作 — 判词:FAIL(head 自身钉红 + 与已合入 #3754 语义冲突,按规程不合并、不 push) head: 阻断点 1:head 在自身提交的钉上红
阻断点 2:与已合入 #3754 是真语义冲突,不是机械冲突本分支的 6 家族建立在 #3754 旧实现
结论与交接把本分支 6 家族移植到 #3754 的 emit-stream 模型上是一次产品改动(不是解冲突),需要重写 |
评审结论:FAIL(不合并)按 p2 车道标准流程处理:merge 1. 基线关系
2. 冲突清单与互斥点
互斥点(同一条 GNU 规则、两个函数):
3. 实测数据(全部 WSL GNU Bash 5.3.20 脚本文件为 oracle)A. PR 的 5 个新测试放到干净 master(不改产品代码): → PR 确有未落地的净增量(procsub 物化、@/$* 分隔符、IFS 夹点),不是纯重复。 B. PR head 自身( → PR 在其 base 上就不是全绿,按流程已不能 ready/merge。 C. 按“保留 master #3754 机制、只重落 PR 增量”解冲突后(4 处冲突取 master、PR 独有的 第二个残余正是为了保留 master oracle 而丢掉 PR oracle 的证据: GNU(WSL 5.3.20): 4. 建议(按优先级)
5. 状态
|
|
【WIN-AGENT-AUDIT】 PR #3755 第4轮 — 建议:FAIL(与已合 #3754 emit-stream 模型互斥,无法机械重落位) 机制核查(复核 p2 车道 08:54 判词,本轮独立抽查属实):
腿:
F 点(维持 p2 列举,供返工引用):
续作记录:无(未 push、未改码;分支保持 未跑/VOID 的腿:
|
|
【WIN-AGENT-BATCH-SUMMARY】 e1 车道 3 PR 全部处理完(判词均为建议,合入裁决归队长)
阻塞项:无。所有腿均已跑或明确标注 VOID/采信来源。 |
|
【WIN-AGENT-AUDIT】 PR #3755 续作报告 — 建议:PENDING(master 基线续作部分落位,3 族残余未移植) 本轮未动原 draft head 已落位(3 commits)
钉自跑(head
|
|
【WIN-AGENT-BATCH-SUMMARY】 f2 车道(#3755/#3744→#3844)批次汇总 — 全部处理完,判词均为建议
阻塞项:#3755 残余 3 族为 emit-stream 深水区移植,需队长裁定续作归属。未合并任何 PR。 |
|
【WIN-AGENT-AUDIT】k1 续作 — 族 B(star7/W_SPLITSPACE)落位,建议 PASS;整体仍 PENDING(族 C 5 钉在 h1 车道在飞) head: 钉自跑(本轮实跑):
机制:移植原分支 ba33521+a6a700373 —— SPLIT_ON_SPACES_SENTINEL(PUA E31C) 端口 W_SPLITSPACE; 协调提示:h1 车道在 h1-3755-port 上有族 A 事故通报:本 worktree 曾被 issue #3295 arithmetic 标签 WIP 污染(19 文件+1 测试,疑为 i1 stash@{0} 的更新稿、可能仅存于此树)——已完整存至 continuation.rs 不在 diff;未碰禁碰分支;commit 均 |
|
【WIN-AGENT-AUDIT】h1 续作 — 族 C(operator-rhs procsub 物化)落位,建议 PASS;三族残余全部清零 head: 注:本 PR 跟踪的 head 分支仍是旧基线 族 C 修法(GNU subst.c:7992 parameter_brace_expand_rhs → 4499 expand_string_for_rhs → 11365-11390 expand_word_internal 的
钉自跑(本轮实跑,
边界核验: 未跑/VOID 的腿:lib 全量双边对照(本 lane 续作协议未要求;钉+相邻回归已覆盖改动面)。 |
# Conflicts: # src/executor/command_prepare.rs # src/executor/command_substitution_values.rs # src/executor/embedded_mutations.rs # tests/issue3605_alternate_fragment_separators.rs
…ACES_SENTINEL when double-quoted (#3605)
…3701 (#3897) 1) Update keeps_comsub_case_subject empty-case expectation to Some("case $(ls) in esac") matching #3843 keeps_empty_case_esac_shape. 2) Restore exit status 2 for unmatched-delimiter EOF diagnostics in script_driver.rs (verified against GNU bash 5.3.20 in WSL: all word-internal pairs and -c/-n/file modes exit 2), keeping #3701 ANSI-C $'...' comsub walker fixes. 3) Restore status 2 assertions in consumer_tests.rs, issue1184_f6_backquote_eof_regressions.rs, and issue3605_eof_exit_status_word_pairs.rs.
Refs #3605.
Stacked on #3754. Fixes the remaining dollar-* word-model families the
macOS gate exposes, verified byte-for-byte against GNU bash
5.3.20(1)-release (script-file probes) with a 451-suite old-vs-new
regression sweep:
=/:=/-/:-stored-value dequote — GNUparameter_brace_expand_rhs(subst.c:8096-8173)quote_escapesthe=result so a CTLNUL is in-field data and only a whole-word CTLNULkeeps
<>; stored marker values dequote to an empty field that isthen dropped. Applied via
dequote_stored_parameter_valueto all sixarms plus plain
$namesplices, and to=bound values themselves(GNU
dequote_stringat bind time, subst.c:8151).$@/$*element separators —string_list_dollar_*(subst.c:2864-3057): IFS[0] join,
' 'under=/PF_ASSIGNRHS, emptyjoin for
$*under empty IFS;*modified forms (${*/pat},${*,,},${*@Q}) join on ifs_firstchar; quoted alternates keeptheir quote state (
param_expandsubst.c:7840-7860).export/readonly/declare/local/typesetoperands carrying=expand with PF_ASSIGNRHS(general.c:480): dollar-at-star8 now 0 diffs.
<>-anchor retention — the raw-level GNU empty-word gate(subst.c:12026-12052):
raw_empty_word_keeps_fieldreplayshad_quoted_null/quoted_dollar_at/PARTIALLY_QUOTEDon the rawword text;
quoted_span_at_listclassifies$@/${@...}/${name[@]...}by operator family. dollar-at-star5 anddollar-at-star10 now 0 diffs.
\inside quoted$@bodies (parse.y CBSDQUOTE):\isliteral backslash inside
"..."; pieces are cooked withcook_double_quoted_segmentinstead of declined. dollar-at-star3 now0 diffs.
IFS=''non-split path strips IFS_GLUE/ANSI_C_IFS_GUARD markers(GNU dequote runs whether or not word_split does).
Current run-dollars dollar-* residual: dollar-star7 (mid-word IFS
assignment — needs byte-level ifs_cmap threading, documented on #3605)
and dollar-at-star9 (in-band
\x7f/^^data collision).a6a70037— mid-word${IFS=}绑定序 + W_SPLITSPACE 终切(dollar-star7 根治)${IFS=}/${IFS:=-}提前绑定,GNUexpand_word_internal(subst.c:11229)是单遍从左到右:绑定在片段位置生效。扩展 rubash#1169 freeze——赋值目标是 IFS 时冻结${*}/${@}/[*]/[@]依赖片段按绑定前值渲染。' '加入保护集(GNU CTLESC 语义)。\x7f族);star7/star11/star4/star6/star9/at-star2/8/10/at7 清零;451 全量重放无归因回归。d63d975 — cli: GNU script-arg prolog
{script}: {shown}: {message}(#3605)GNU
shell.c:1604-1620rebindsdollar_vars[0]to the spelled script name right afteropen(2)succeeds, so post-open diagnostics use the script's own name as prolog (error.c:74-117):bash /tmp→/tmp: /tmp: Is a directory,bash /bin/ls→/bin/ls: /bin/ls: cannot execute binary file; PATH hits print the resolved path in the second slot (shell.c:1595-1597). Open-time failures keep the shell name. Verified byte-for-byte vs GNU bash 5.3.20.dec11f9 — new-exp:
${var op word}alternates materialize<(/>((run-new-exp)GNU
parameter_brace_expand_word(subst.c:7663) hands the word half of${var op word}back toexpand_word_internal, whose scan owns the</>process-substitution cases (subst.c:11365-11385). Fixes all three divergent paths:expand_embedded_parameters_alternate_mut(the funnel for every operator-word expansion — routed:-/+/=/:=/?arms + thebraced_alternate_word_valuesargv fast path) materializes the word's own unquoted procsub spans first. Quote-aware scan keeps"<(/\<(literal (subst.c:11369 Q_DOUBLE_QUOTES); value-borne<(stays data (expansion output is appended, never re-scanned).${...}fragments (9:${foo+<(G)}) routed to the mutable walker — the&selfexpand_wordcan never spawn a substitution child (same reason$(/backtick words take it)."${u:-<(D)}"stays literal:param_expandpropagatesquotedinto the alternate's re-expansion (subst.c:7840-7860); the${fragment arm now propagates its quoted-site state (in_doubleor QUOTED_EXPANSION_SITE) as DoubleQuoted context.rhs_has_procsub_textnarrowed withraw_word_has_unquoted_process_substitution—y=${x:-<(echo b)}keeps x's value-borne<(echo a)literal.Verified: 14-case matrix (arg/assign ×
:-/+/:=/>× set/unset/quoted/value-borne/nested) byte-for-byte vs GNU 5.3.20; run-new-exp loses every procsub hunk (residuals: shell-name/ rubash$, bad-substitution payload, unbound-variable lines — all recorded); pinissue3605_alternate_procsub_materialization8/8.