Skip to content

test: wave-2 pins E3 (Refs #2713 #2752 #3085 #3086) - #3164

Merged
caomengxuan666 merged 12 commits into
masterfrom
test/E3-wave2-pins
Nov 10, 2026
Merged

caomengxuan666 merged 12 commits into
masterfrom
test/E3-wave2-pins

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

第二波「钉先行」E3 组:四单的产品修法面被在飞 PR 占着(#2713/#2752 的 parameter_core.rs 等 #3152 合入;#3085/#3086 系 #3088 残余),先落回归钉 + 根因/修法设计(REPORT 在车道工作区),门一开修法车道当天能动。钉先行期本 PR 只新增测试文件;门开后三单修法已在本 PR 后段提交落地(#3086 仅钉、修法不在内)。

逐单:

fail-first 结果(真基底 f17644d7,逐格)见车道 REPORT。

本 PR 删除了什么

无文件删除、无功能移除。产品代码净 +196/−13:删除的 13 行均为被替换的实现行——parameter_core.rs 8 行(两处 .trim() 全修剪实现、span-only 回显调用行等)与 parameter_errors.rs 5 行(以已求值数字组装负长度诊断的旧构造),分别由原文回显/只去首空白/原文切片构造取代;其余为纯新增(界定价与门控、下标 $' 解码臂、钉文件 +779 行)。

GNU verify_substring_values (subst.c:8395) hands evalexp the raw operand text; evalerror (expr.c:1526-1537) skips only leading whitespace. Keep trailing blanks in echoed expressions and error tokens, report the raw length slice in the negative-length diagnostic, and echo a lone quoted operand whole when trailing blanks belong to it.

Refs #2713
GNU verify_substring_values (subst.c:8428-8464) range-checks the offset against the value-kind bound before the length text is expanded or evaluated; an out-of-range offset returns -1 with no diagnostic, so the length operand's side effects and errors never happen. Both parse variants take the same gate.

Refs #2752
Assignment-path subscripts ANSI-C decode a dollar-single-quote span and sh_single_quote it before the arithmetic pass (GNU read_token_word cooking; expand_string_dollar_quote, subst.c:4133); the read path decodes the span to bare content on the span-data carriers before the arith-context pass (expand_subscript_string ansicstr arm).

Refs #3085
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 10, 2026 04:10
@caomengxuan666
caomengxuan666 merged commit beab07d into master Nov 10, 2026
11 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 10, 2026
…scan (Refs #3225) (#3253)

Refs #3225

## What changed

The parameter-expansion error pre-scan (a verdict-only pass layered over
the real expansion) parsed `${var:offset:length}` substrings through the
REPORTING element fetch, so a bad array subscript was printed once by the
scan's NULL probe (twice, via the operator-value error fallback) and once
more by the real expansion — three reports where GNU prints one
(subst.c:9777 `parameter_brace_expand` fetches the parameter once; the
diagnostic itself is arrayfunc.c:1483 `err_badarraysub`).

- `parameter_core.rs`: `parse_parameter_substring` gains a scan-mode twin,
  `parse_parameter_substring_for_scan`, whose NULL probe derives from the
  non-evaluating `pre_scan_operator_value` (the same discipline the
  operator arms already used). Only a provably-set parameter continues
  the full parse; unset or undecidable shapes take the NULL shortcut,
  which is verdict-equivalent for the scan's only question (the substring
  error fires only for a non-NULL value). The real expansion path is
  untouched.
- `parameter_errors.rs`: the substring negative-length arm calls the scan
  twin; `pre_scan_operator_value` visibility widened to
  `pub(in crate::executor)`.
- Pins in `tests/issue1555_scalar_subscript_bad_subscript_regressions.rs`:
  the existing combined pattern+substring cell already expected the GNU
  count (2) and was red at 4 on the base; four new cells pin the substring
  form alone (quoted / unquoted / real-array OOB), the non-literal
  subscript substring forms plus the `i++` side-effect count, the pattern
  forms staying at one report, and the verdict set staying unchanged.

## Evidence (Simular box, head 41cbc14, branch base 9ec0355)

- Head pin stem: 16 passed / 0 failed, with a per-test line for each of
  the 16 cells (box log `fc3225-logs3/head-issue1555.log`).
- Base with the new pin file: 12 passed / 4 failed — the failures are
  exactly the pre-registered cells (the combined form, the substring
  form, the non-literal substring form, the verdict cell); the pattern
  cell is green on both sides.
- Neighbour stems: issue1600 10/10, issue2343 5/5, issue2794 7/7,
  issue3024 23/23, issue3063 22/22, issue755 11/11, issue772 6/6,
  parameter_transform_tests 18/18 (see the note below).
- Lib: head 1207 passed / 0 failed; base 1207 passed / 0 failed —
  failure name sets identical (empty on both sides).
- `cargo fmt --check`: clean. Marker-literals lint: clean.
- `-D warnings`: the lib and this PR's pin target check clean. A full
  `--all-targets` check stops at one error that pre-dates this change —
  a dead helper at tests/issue2634_extdebug_bash_argc_sticky.rs:46,
  reproduced identically on the base tree (test-hygiene face, unrelated
  to this diff).

Note on parameter_transform_tests: run in a bare worktree whose target
dir lives outside the tree, all 18 cells fail at their output redirect
(`target/...-output.txt: No such file or directory`) before any
semantics run; with the in-tree target dir present the stem passes
18/18 on the head. Recorded here so that red is not misread later.

## Merge note

The branch base (9ec0355) pre-dates PR #3164 (landed as beab07d),
which touched the same two executor files in different functions;
expect a small same-file conflict surface at update-branch time.

## 本 PR 删除了什么

Nothing. No code or tests are removed: one probe call in the scan arm
is replaced by its scan-mode twin, one visibility is widened, and four
pin cells are added.
caomengxuan666 added a commit that referenced this pull request Nov 10, 2026
… the quoted operator-word decoder (#3258)

Refs #3086

## 概要

`$"..."` 在 C 语言环境下与 `"..."` 完全等价(GNU subst.c:4133 `expand_string_dollar_quote` 的 `$"` 臂;subst.c:1639 `sh_mkdoublequoted`),但 rubash 有三处扫描面没有 `$"` 臂。本 PR 按机制补齐三处,而不是按 `$((...))` / `${...}` 等形状逐个打补丁:

1. 共享嵌入参数 walker(`&self` 与 `&mut` 两份扫描实现):`$` 后跟 `"` 原落入兜底臂被逐字输出,`$(( $"1+2" ))` 报操作数错误、`${q-$"a b"}` 的默认词被误读。
2. 引号上下文算子词的提取期解码器 `decode_double_quotes_in_quoted_parameter_word`:它有 `$'` 臂(提取期 ansiexpand)却无 `$"` 臂——`$"a b"` 的引号被当普通双引号句剥掉、孤儿 `$` 喂给展开 walker 后把 span 首词当参数名展开(`${q-$"a b"}` 在双引号上下文里得到 ` b`,`$"ab"` 整体消失)。

## 修法

- `src/executor/embedded_parameters.rs`(`&self` walker,`expand_embedded_parameters_inner` 的 `$` 分发):新增 `Some('"')` 臂,守卫 `!heredoc && !in_double && !double_quoted`。触发时消费 `"`、置 `in_double`、preserve_quotes 模式保留引号形——与该 walker 既有的裸 `"` 臂完全同规,span 内容与闭引号由同一主循环按双引号语义续扫。
- `src/executor/embedded_mutations.rs`(`&mut` walker):同样的臂,守卫另加 `context == Unquoted`,并同步该 walker 裸 `"` 臂的 alternate 模式引号空值记账(`dquote_open_len`)。`${...}` 的赋值形(如 `:=` 默认词)经此 walker,故两面都必须补。
- `src/executor/parameter_words.rs`(`decode_double_quotes_in_quoted_parameter_word`):在裸 `"` 句解码前消费 `$"` 的 `$` sigil,让 span 走既有双引号句解码。GNU 依据:提取期 reader 把 `$"..."` 先 locale_expand 再以 `sh_mkdoublequoted` 重裹成真双引号 span(parse.y:5546-5610 `read_token_word`,重裹在 parse.y:5582-5595;`${...}` 提取扫描同源,parse.y:4095-4126)。`heredoc` 时不触发,与同函数 `$'` 臂同门控。

## 钉与验证

- 回归钉 `tests/issue3086_dollar_locale_quote_walker.rs`(12 格)已随 PR #3164 入 master,本 PR 不动钉。
- 队长复核(Simular box 自有克隆、基底/头双树逐茎判读,卷宗 `~/workspace/review-3258/CAPTAIN-VERIFY.md`):基底 fail-first 2 绿 / 10 红,红集恰 D1–D6、D8–D11(绿为 D7/D12 两控制格),与预登记逐格吻合;头钉 12/12;邻茎 9 茎全绿(issue3085/2713/2752/3024/3023/2210/2217/3071/2343);lib 双边 1215 passed / 0 failed、失败名集双边为空且恒等;`RUSTFLAGS="-D warnings"`(lib + 本钉目标)rc=0;`cargo fmt --check` rc=0;`check-marker-literals.py` OK。
- GNU 差分扫 21 探针:19 same;余 2(`${q:?...}` 错误词面)为先存残差,队长复核以 base/head 双二进制受控对照证实逐字相同(非本 PR 引入),已另行立案跟进。

## 本 PR 删除了什么

无文件删除、无功能移除。产品代码净 +63/−0:三处扫描面各新增一个 `$"` 分发/解码臂,未删除或替换任何既有实现行。
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