Repository navigation
parser/executor: quoted compound markers are plain command names (#3557) - #3612
Merged
Merged
Conversation
…s (Refs unixwin/niubash#955) The pin-stem census (rubash#3430) enumerated tests/issue*.rs only, so the ~83 non-issue stems (oils spec corpus, executor_tests, lexer/parser matrices, deep audits, enable_dynamic_loading, multi_session_isolation) never executed anywhere -- niubash#955's visibility gap. - scripts/ci-run-pin-stems.sh now enumerates tests/*.rs; any new target is covered by default. - scripts/ci-pin-exclusions.txt gains an ELSEWHERE class for stems that already run in a dedicated lane (cli_tests, regression, marker_leak_golden) plus first-census entries for the stems red on master (2026-11-14 Linux census: 2721 tests, 2567 pass / 154 fail / 36 skip). executor_tests was re-run serially (52 red of 1561) to separate parallel-load flake from product red. - .config/nextest.toml: the intended hard-kill never existed -- timeout-source/termination-timeout are unknown keys nextest silently ignores, so a hung test would still eat the job. Real config: slow-timeout period=30s terminate-after=3 grace-period=10s, i.e. log at 30s, kill by name at 90s -- exactly what the comment promised. - New profile.ci override pins enable_dynamic_loading to threads-required=num-test-threads: its tests share the target/enable-dynamic-fixture .so and race under the parallel schedule (serial run: 10/10 pass). Box verification: stub-cargo run enumerates 1381 stems with all 104 exclusions applied and no stale entries; full nextest census of the 83 new stems ran on this Linux box (raw logs under target/issue-suites/results/niubash955-*). Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…ash#3557)
GNU read_token (parse.y:3667) recognizes '(' / '{' / '[[' / '((' and the
reserved words !, function, case, for, select, coproc only when they
arrive unquoted; a quoted '(' word is data, so '(' echo hi ')' reports
'(: command not found' (127) and continues instead of running a subshell
or dying on an EOF parse error.
Two layers over-read the marker:
- parse_loop.rs: the '{' EOF-error arm, the '[[' dispatch, the '(('
starts_with arms, and the time-prefixed compound probe matched
token.value only. Gate them on the unquoted spelling
(is_unquoted_operator / raw == value), the codebase's own
quoted-vs-operator discriminant.
- executor alias re-lex probes (execute_alias_introduced_*): they
emulate parse.y:3249 alias_expand_token + push_string, which re-lexes
only the alias VALUE. They fired whenever the expanded head word
equaled the marker — including a literal '(' / '{' / '!' / 'function' /
'case' / 'coproc' / 'for' / 'select' that was never alias-introduced.
Decline when the command's own head word is already the marker.
- command_dispatch_late.rs LateSlot::Arithmetic: a words-only '((' head
(no arithmetic_command node — only reachable when quoted) ran as
arithmetic; route it to command-not-found like '[[' already does.
Verified byte-for-byte vs GNU bash: '(' echo hi ')', '{' echo hi '}',
'!' echo bang, 'coproc' x, '[[' x = x ']]', '((' 1 '))', 'function' f,
'case' x, 'for' x, 'select' x all print '<w>: command not found' (127)
and continue; unquoted (/{/[[/((/!/time compounds and an
alias-introduced 'lp='('' subshell reparse are unchanged.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Member
Author
|
【WIN-AGENT-AUDIT】 合入阻塞(不合、不关):
机制核查:
腿:
F 点:无(内容面未见问题)。 未跑/VOID 的腿:
处置:本轮不合入、不关 #3557;rebase 丢 ci.yml 旧 hunk 后可直接复审合入。 |
# Conflicts: # .github/workflows/ci.yml
Member
Author
|
【WIN-AGENT-AUDIT】 冲突消解:
机制核查(沿用第1轮结论,本轮合并未改语义面):
腿(全在 c3475c4 上重跑):
F 点:无。 续作记录(本轮):
未跑/VOID 的腿:无。 |
caomengxuan666
added a commit
that referenced
this pull request
Nov 16, 2026
…eters (Refs #3783) ## 根因 `test -v` / `[[ -v ]]` 的全数字操作数恒返 false:`builtins::test::variable_is_set` 只查变量表(+ 动态参数),而位置参数从不进变量表,所以 `test -v 0`、`test -v 1` 等一律判未设置。 ## GNU 锚点 - `test.c:650-685`(unary `-v`):先 `valid_array_reference`,再 `valid_number(arg, &r)`,答 `r >= 0 && r <= number_of_args()`。 - `general.c:248-281` `valid_number`:strtoimax base 10,可选符号、前后空白、溢出判非法。 - `builtins/common.c:429-446` `number_of_args()`:即 posparam_count($1..$N 的个数,不含 $0)。 结论:`0` 恒 set;`N` 存在即 set;前导零按数值解析(`00` 即 $0、`01` 即 $1);`[[ -v N ]]` 与函数帧内同理。 ## 修法 - `src/builtins/test/variable.rs`:`variable_is_set` 增加 `positional_count` 参数;nameref 判定后用既有的 `super::valid_number` 做位置参数探针:`n >= 0 && n <= positional_count`(空串位置参数仍计入)。 - 线程化 `positional_count`(均为 live window 长度 `ShellState::positional_len`,帧感知):`test.rs`、`command_dispatch_late.rs`、`conditional.rs`、`simple_if.rs`、`test_tests.rs`。 - 回归钉 `tests/issue3783_test_v_positional_regressions.rs`:6 组,覆盖 seed 12 项 + 边界矩阵(`+1`、前后空白、`-1`、溢出、`0x1`/`1e1`/`1abc`、空串位置参数、`[ -v 0 ]`)。 ## 本 PR 删除了什么 无删除。仅新增:`variable_is_set` 等函数的 `positional_count` 参数与一处位置参数探针分支、回归钉文件 1 个。无行为删除,无公开面变动(未碰 `docs/api-ledger.md`、`src/lexer/continuation.rs`)。 ## 验证(队长已核) - X299 腿:fail-first 钉 1/6(仅 controls 组过,PIN_RC=101);修后钉 6/6;邻钉 #2710 2/2、#2073 3/3、#1707 4/4;`builtins::test` 单测 38/1;全量 lib 双边 1356/1 = 1356/1(唯一败 `issue2084_session_end_restores_host_process_state` 双边同格);`RUSTFLAGS="-D warnings" cargo check --locked --lib --bins` rc=0;seed 脚本对 built rubash.exe 12/12;GNU oracle seed 12/12;rustfmt 直核 7 文件 rc=0。 - CI run 43897420929(头 e23cc71,update-branch 到 master b5b0003 即 #3699 合入点):goldens 仅 `issue_753::case_9` + `upstream_suite_slice_snapshots`(与 master 逐格一致);census 86 败格 = 85 基线 + 1 主干继承格 `at_sign_at_a_quoted_with_colon_ifs_does_not_split`(master 跑 43895963546 同格 FAIL,旧头同格 PASS);CLI tests 单格 coproc 时序抖动 `c_command_keeps_named_coproc_output_fds_distinct`(left "first:\n" vs right "first:second\n"),重跑后绿;其余全 pass(darwin、linux/android、rust tests、macOS、shell、windows 编译、niubash 构建、ledger)。 - 队长复核:调用面 rg 已核(variable_is_set 外部 2 处、test::execute 6 处,无遗漏);`positional_len` 语义由钉边界格实测覆盖;漂移 hunk(#3612 的 command_dispatch_late.rs `((` 面)与本 PR hunk 相距约 260 行,update-branch 干净合入。 Refs #3783
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3557.
Problem
'(' echo hi ')'ran a subshell and'{' echo hi '}'died onsyntax error: unexpected end of file. GNU treats the quoted markers as plain words:(: command not found/{: command not found, status 127, script continues.GNU basis
parse.y:3667 read_token:(is an operator and{/}/reserved words (!,function,case,for,select,coproc,[[,(() exist only unquoted in the token stream; a quoted marker is a word.parse.y:3249 alias_expand_token→push_string: only an alias value is pushed back through the lexer, which is why theexecute_alias_introduced_*probes exist at all.Fix (two layers over-read the marker)
parser/parse_loop.rs — gate value-only matches on the unquoted spelling (
is_unquoted_operator/raw == value):{-EOF arm,[[dispatch, both[[/((-starts arms, and thetime-prefixed compound probe.executor — the alias re-lex probes fired whenever the expanded head word equaled the marker, including a literal
(/{/!/function/case/coproc/for/selectthat was never alias-introduced. Each probe now declines whencommand.words.first()already is the marker — only an alias-emitted head may take the re-lex path.command_dispatch_late.rs —
LateSlot::Arithmeticclaimed any((-headed words list; a quoted'(('produces noarithmetic_commandnode, so it now falls through to command-not-found like[[already did.Verified vs GNU bash
Byte-for-byte on the whole class:
'(','{','!','coproc','[[','((','function','case','for','select'all print<w>: command not found+ 127 and continue;x=5; '((' x++ '))'printsx=5unchanged. Unquoted(,{,[[,((,!,time,casestill form compounds; aliaslp='('still reparses to a real subshell.Regression pins in
tests/issue3557_quoted_compound_marker_regressions.rs(6 tests).Written by Devin