Repository navigation
fix(executor): keep ${param OP word} rhs separators as one-word affixes - #3754
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>
|
【WIN-AGENT-AUDIT】s2 PR #3754 第1轮 — 建议:FAIL(草稿,未合并、未关 #3605) 机制核查:
F 点:
腿:
续作记录:无(本 lane 不改代码) 未跑/VOID 的腿:lib 双边、-D warnings、fmt/卫生、CI 逐格(原因:GNU 对照已定案 FAIL,未继续消耗构建) |
Address audit findings F1/F2 on the emit-model rework: the rhs of an
unquoted braced alternate is assembled as ONE word and split once, not
segmented per piece (GNU expand_string_for_rhs runs the rhs under
W_EXPANDRHS|W_NOSPLIT2, subst.c:4462-4501, so add_ifs_character leaves
expansion-produced IFS bytes raw for the deferred split,
subst.c:11950-11980, :12098-12160).
- fuse_alternate_word_fields: word-level W_NOSPLIT2 rejoin
(subst.c:12123-12148) — has_dollar_at without quoted_dollar_at under a
set IFS not starting with ' ' splits the assembled word on the IFS
chars then rejoins with ' ' into ONE field; quoted pieces are
IFS-protected like GNU's CTLESC and `\<char>` escapes stay glued.
- emit_unquoted_alternate_fields + emit_alternate_scanned_text:
expansion-produced text under an unquoted outer is re-scanned for
ambient-IFS chars — `${q:-$*}` under IFS=: splits the $* join bytes,
unquoted $@ element internals split under a ' '-first IFS, and
element boundaries stay hard under an empty IFS. Carrier bytes keep
their payload opaque.
- embedded `"pre${name OP rhs}post"` alternates carrying a $@-class
list resolve through BracedAlternate segments precomputed against
&mut self (Fn-closure constraint), with the had_quoted_null
empty-field for a quoted word whose rhs produced nothing
(subst.c:12026-12035): `n "${foo-$@}"` yields one empty arg.
- protected_lists narrowed to genuinely quoted contexts — under an
unquoted outer every expansion byte is unprotected (subst.c:12153).
Gate replay (macOS, GNU bash 5.3.20 oracle): dollar-* subs match the
pre-rework baseline per-sub; 4 probe matrices (fuse/separator/embedded/
escape) byte-identical; 6/6 pin tests green.
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
@caomengxuan666 F1/F2 返工完成, F1( F2( 验证:4 组探针矩阵(fuse / ' '-first IFS / IFS='' / \ 转义)对 GNU 5.3.20 逐字节一致;run-dollars 全 29 个 dollar-* sub 与 base 逐行对齐(残余 star9/star7/at-star3/at-star5 各行均为已登记的独立族,非本 PR 域);pin 6/6;fmt/marker-lint 净。 |
|
【WIN-AGENT-AUDIT】t2 批次汇总(S 波收尾,5 条)
阻塞/移交项:#3754 全腿验证待补;#3741 需定位 stale FileFd 句柄生产者(候选:spawn fd transport / carrier 探测路径)后重制定修;#3747 |
|
【WIN-AGENT-AUDIT】PR #3754 第2轮 — 建议:FAIL(两枚确定性回归,钉外既有 guard 被打破) 续作记录(本轮动过代码):
机制核查:
腿(逐项数字):
F 点:
未跑/VOID 的腿:CI darwin cross-target 与 Rust tests (macOS) 在写报告时仍 pending(run 43916978963 未完成);不影响判词——F1/F2 已由本机确定性复现定案。 |
|
【WIN-AGENT-AUDIT】u1 批次汇总(U 波收尾,5 条)
阻塞/移交:#3754 待返工(空首元素族);#3747 待返工(? 尾解析后判定,special+named 源);#3741 待返工(stale FileFd 根因定位);#3740 待队长三选一裁定;#3724 已落地。 |
…(Refs #3605) An unquoted `${param OP word}` rhs whose word is a `"..."` piece containing a `$@`/`$*`-class list was routed through the unquoted-segment emitter, so its literal interior spaces turned into word boundaries and the field text lost them (`IFS=:; set -- ${u- "x $* y" }` gave `< xa:by >`, GNU `< x a:b y >`). Only a double-quoted outer needs that route: parameter_brace_expand_rhs strips embedded unescaped `"` there (subst.c:7977-7984 string_extract_double_quoted SX_STRIPDQ), so the rhs behaves as one double-quoted string whose literal IFS bytes delimit the deferred split (subst.c:12098-12160). Under an unquoted outer the piece is an ordinary double-quoted word, so expand it with the word machinery (subst.c:7966-7990 expand_string_for_rhs, quoted == 0). Also carry the quoted context into alternate_list_fields so a `${name[@]<op>}` token scanned from a quoted piece expands as `"${name[@]<op>}"`, keeping empty elements (subst.c:7840-7860 param_expand propagates `quoted`); the unquoted path keeps the bare expansion. This restores the guard_slice_fans_out / guard_147 empty first element (GNU argc=2, `[][foobar]`). Verified against WSL GNU bash 5.3.20 byte-for-byte on 24-shape and 6-shape matrices; pins issue3605_alternate_fragment_separators 6/6, issue315_guard_alternate_regressions 5/5, arrdefault_quoted_array_default_regressions 11/11, issue1993_dollar_star_regressions 5/5.
|
【o1 收网验证 · 建议 PASS】head 机制锚点:unquoted-outer 下 rhs piece 是普通 腿(Windows,本机):
关联 #3605:伞目录,保持 OPEN。 |
|
【WIN-AGENT-AUDIT】o1 续作 — 判词:PASS(修复审计第2轮的两枚确定性回归) head: 腿:
F 点:F1(非空白 IFS 字面分隔符在 rhs 内切分)与 F2(outer dquote 下 CI(run 44028311144, head d155a19):红 = goldens + census,逐格与同窗口 master run 44027140238(f02d7299)比对:
关联 issue:#3605 伞目录,不关。 |
|
【o1 收网】第3轮 — 判词 PASS,已合并 mergeCommit head: d155a19(在 90a9b90 上叠 2 个 commit: F 点回应
本轮自查新发现并修掉的同 PR 族(上轮审计未覆盖)
腿(全部本轮实跑,Windows MSVC + WSL GNU 5.3.20(1))
未跑腿/说明: |
…#3605) Ports the remaining dollar-star7 mechanism onto the master emit-stream model (original-branch commits ba33521 + a6a7003, re-resolved against #3754's emit stream and the family-A $@ arms): - markers.rs: SPLIT_ON_SPACES_SENTINEL (PUA E31C) + contains/strip helpers — the in-band port of GNU's W_SPLITSPACE word flag. - expand_braced_special.rs: unquoted ${*} under a set-null IFS joins on ' ' with element whitespace marked and emits the sentinel; quoted (extquote context), assignment-RHS and NO_SPLIT_DOLLAR_STAR contexts keep string_list_dollar_star's concat join (subst.c:10612-10670, 2902-2930). - expand_braced_replacement.rs: NO_SPLIT_DOLLAR_STAR thread-local; parameter_patterns.rs sets it for ${paramOPword} pattern RHS (expand_string_for_pat, subst.c:4518). - embedded_{parameters,mutations}.rs: bare $@/$* arms take the element-wise string_list_dollar_at model — per-element whitespace marking under set-null IFS, sentinel emission, quoted-piece concat — merged with the family-A in_double protect_ifs_field_chars path. - arrays.rs field_split_values_with_ifs: sentinel forces the split charset to " " (IFS set) / " \t\n" (unset) regardless of a later mid-word IFS bind (subst.c:11535 -> 12103-12107). - parameter_words.rs: extend the rubash#1169 pre-scan freeze to IFS-dependent fragments (fragment_depends_on_ifs) so earlier ${*}/${@} pieces render under the pre-bind IFS; embedded walkers add ' ' to the quoted-span protected set when the word carries the sentinel. Verified byte-for-byte vs WSL GNU bash 5.3.20(1) on the star7 puzzle matrix and quoted/unquoted $*/${*}/$@ probe shapes. Pins: issue3605_star7_splitspace_ifs_regressions 4/4 (was 1/4), dollar_at_star_ifs_separators 8/8, quoted_null_anchor 4/4, operator_value_ctlnul 8/8, alternate_fragment_separators 6/6. Residual: quoted bare "$*" inside a mixed word under null IFS still joins on ' ' (concat expected) — same class as the recorded star7 line-4 residual on #3605. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Refs #3605
根因
${param OP word}的 rhs 在 GNU 里是一个 word(subst.c:7840-7860param_expand经普通 word machinery 展开 rhs):${0+ "$@" }= 前缀+"$@"+ 后缀,词间空白作为 affix 文本 glue 到$@的边界 field 上,再由expand_word_list_internal/expand_word_internal末尾的统一字段切分处理。expand_alternate_word_fragment把片段重新词法解析成__rubash_parameter_alternate__ <fragment>,lexer 丢掉了词间空白:"$@"变成裸"$@",IFS='' 或非空白 IFS 下产生<a b>/<c>,GNU 是< a b>/<c >(dollar-at-star9.sub${0+ "$@" }族)。修法(fb1422fa rework — 审计 F1/F2)
按 vendored subst.c:12026-12160 的完整真值表实现 unquoted-outer rhs:
protect_ifs_field_chars),扩展产出的 IFS 字符不受保护、参与切分(emit_alternate_scanned_text扫描层)。has_dollar_at && !quoted_dollar_at && ifs 非空 && ifs[0]!=' '(subst.c:12090/12123)→list_string+string_list式 rejoin,整词收成一个 field(fuse_alternate_word_fields);ifs[0]==' '或 IFS 空 → 走调用方常规切分;quoted_dollar_at(如"$@"piece)→ split on IFS 且元素保护。$*/[*]不置 has_dollar_at,正常切分。n "${foo-$@}"→ 1)。BracedAlternate嵌入路径同步建模;marker 走 registry(无裸\u{EXXX}字面量,marker-lint 净)。本 PR 删除了什么
原
fuse_alternate_list_segment(词级 fuse 上位后死代码)与 per-piece fuse 逻辑。验证(全部对 GNU Bash 5.3.20 逐字节)
$@/$*× IFS=':';IFS=' :'、IFS=''、IFS='!';\转义;嵌入 braced alternate):ALL_MATCH。tests/issue3605_alternate_fragment_separators.rs6/6 绿;fmt、marker-lint 净。相邻残余(不修,另族)
n "$(true)$@"→ 0 vs GNU 1:HEAD 上既存分歧,非 alternate-scoped。