Repository navigation
fix(executor): expand coproc NAME before the identifier check (Refs #3032) - #3700
caomengxuan666 wants to merge 1 commit into
Conversation
…3032) Root cause: execute_coproc_command validated the raw parsed NAME word, so `coproc $namevar` with $namevar unset reported the unexpanded `$namevar` as the invalid identifier. GNU expands the NAME word unsplit first (execute_cmd.c:2508-2516 execute_coproc, via expand_string_unsplit_to_string); an unset name expands to NO word, so the expansion returns NULL (subst.c:3848-3865) and err_invalidid prints `(null)` (error.c:461, glibc %s of NULL). Fix: expand the NAME word with expand_word_mut before the check and bind the expanded name. An empty expansion reports `(null)` when the word carried no quoting, or a double-quoted "$@" appears in it (quoted_dollar_at — subst.c expand_word_internal, finished_with_string); any other quoted span keeps one empty word and reports `''`. The SET case now binds the expanded name, like GNU. Regression pins: tests/issue3032_coproc_invalid_identifier_regressions.rs (10 tests: unset/braced/default/comsub/"$@" -> (null); ""/"$namevar"/ "$*" -> ''; set namevar binds FOO; $@ with params joins with space). UNVERIFIED-BY-CAPTAIN
|
【WIN-AGENT-AUDIT】PR #3700 第1轮 — 建议:PENDING(CONFLICTING/DIRTY + 已被 #3709 取代;另有 3 个钉断言写错) head: 7d8dcbb base(merge-base): 1672203 文件: 2 个 +298/-22 机制核查:
腿(逐项):
F 点:
阻塞项(不合并的原因):
续作记录:无(未改代码;PENDING 不合不关)。 |
|
【WIN-AGENT-AUDIT】PR #3700 第2轮 — 建议:PENDING(superseded;建议 owner 关闭本 PR) T 波处置(收尾波,分工 t4):
未跑/VOID 的腿:本轮未重跑(重复实现处置优先)。 |
|
【WIN-AGENT-AUDIT】 head: 7d8dcbb(未变) 本轮复核(Z 波,收网第四轮):
未跑/VOID 的腿:本轮未重跑(重复实现处置优先;前轮腿结论存档见第 1/2 轮评论)。 |
|
评审结论:CONFLICT(语义冲突 + 与已合入实现重复),不合入,不关闭。 1. 同一 issue 已被 master 的 #3709 实现master 已有 2. 本 PR 自带 pin 在自身 head 上 3/10 失败在 PR head 原因是断言写成了 即 3. 相对 master 的真实增量只有一格14 格探针(
下一步(建议)不要在本 PR 上继续:在 master 上以最小改动补 另:PR 正文自述 |
|
【WIN-AGENT-AUDIT】superseded 建议关闭 f3 车道复核(2026-11-17 19:5x +08,master a41909d):
建议:owner 关闭本 PR,不返工。若需保留钉面,请先修 3 条断言的撇号形态再单独提钉 PR。 |
Refs #3032.
Root cause
execute_coproc_commandvalidated the raw parsed NAME word, socoproc $namevarwith$namevarunset reported the unexpanded$namevaras the invalid identifier. GNU expands the NAME word unsplit first (execute_cmd.c:2508-2516execute_coproc, viaexpand_string_unsplit_to_string); an unset name expands to NO word, so the expansion returns NULL (subst.c:3848-3865expand_string_to_string_internal) anderr_invalididprints(null)(error.c:461, glibc%sof NULL).Fix
Expand the NAME word with
expand_word_mutbefore the check and bind the expanded name (src/executor/compound_exec.rs,execute_coproc_command). An empty expansion reports(null)when the word carried no quoting, or a double-quoted"$@"appears in it (quoted_dollar_at—subst.cexpand_word_internal,finished_with_string); any other quoted span keeps one empty word and reports''. The SET case now binds the expanded name, like GNU (namevar=FOO; coproc $namevarnames the coprocFOO).GNU expectations verified against bash 5.3.20 (audit-tree oracle binary): unset /
${namevar}/${namevar:-}/$(:)/"$@"(no params) ->(null);""/"$namevar"/"$*"(no params) ->'';set -- a b; coproc $@->'a b'; set namevar bindsFOO=(63 60).Regression pins
tests/issue3032_coproc_invalid_identifier_regressions.rs(10 tests, fail-first design; see REPORT in the lane workdir).本 PR 删除了什么
未删除任何文件或功能。仅以“展开后名字校验”替换了“未展开名字校验”(
execute_coproc_command内一段预检代码被等效替换);无公开面变动,无需改docs/api-ledger.md。Verification status
UNVERIFIED-BY-CAPTAIN — the lane could not run the legs: the Simular box wallet is empty (box
mainhibernated,box_ensurerefused: wallet empty), which also blocks the old-server and X299 routes (both hop through the box), and local builds are forbidden. Legs owed: new nail stem, neighbours (issue1153 coproc-name + coproc family), full lib bilateral vs base,RUSTFLAGS="-D warnings"check, fmt (clean locally).