Repository navigation
fix(parser): 赋值前缀 + 子 shell — GNU 形态(审计语料 #452 集群1) - #453
Merged
Merged
Conversation
This was referenced Oct 9, 2026
Merged
caomengxuan666
added a commit
that referenced
this pull request
Oct 9, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 10, 2026
…(rubash#462) (#476) GNU function_def (parse.y:1054) admits ANY single WORD before `()`, and read_token_word folds an unquoted `$( ... )` into the current word (parse.y:5513-5532), so `f$()g() { :; }` parses; the expanded name is validated only at definition time (valid_function_word). rubash's parser rejected such words because the substitution text's `(`/`)` tripped the word-structure character check, breaking zZshFramework files.sh. - parser/support.rs: mask `$(`/`${`/`$[` and backquote spans before the function-name structure checks (is_function_name / is_function_keyword_name); bytes inside a span are substitution text, not word structure. - parser/parse_loop.rs: admit Variable/CommandSubst tokens at the function-definition gate (`$x() { :; }`, `$(echo f)() { :; }` lexes the name as its own token kind). - executor/function_calls.rs: a raw name carrying a backquote span is definition-time invalid, matching GNU's `` `echo f`': not a valid identifier'``. Runtime behavior matches the GNU 5.2.37 msys oracle byte for byte: definitions parse (`-n` rc=0) and names containing expansions are rejected non-fatally with `` `RAW': not a valid identifier'`` (rc=1), execution continuing. tests/issue462_funcdef_name_cmdsub_regressions.rs pins the issue's boundary table, the keyword/backtick forms, break characters outside the span, and the assignment-prefix (#453) control row. cargo fmt also reflows a pre-existing path.rs test to satisfy the fmt gate. Oracle: D:\Git\usr\bin\bash.exe (GNU bash 5.2.37 msys), 2026-10-10. Closes #462
This was referenced Oct 10, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 10, 2026
…m-down, notes draft) (#498) - Cargo.toml: version 1.3.4 -> 1.4.0 (crates.io latest published is 1.2.0) - CHANGELOG: regroup the Unreleased section into a 1.4.0 section (新增/修复/性能/平台/构建/文档), folding in the merged PR batch #453-#495 plus the #460-#465 issue fixes, deduplicated - packaging: exclude tests/ and third_party/ from the published crate — 2053 files / 15.6 MB -> 400 files / 8.9 MB unpacked, back under the crates.io 10 MiB cap; compile verified via cargo publish --dry-run - docs: bilingual release-notes draft at docs/release-notes-1.4.0-draft.md
SpookyWaste
pushed a commit
to SpookyWaste/rubash
that referenced
this pull request
Nov 12, 2026
… (test-only) Battery adjudication on master 9348b8d (freeze-150 adj-signals / adj-engine / adj-semantics / adj-cli / adj-fd) found 13 regression pins whose expectations contradict the GNU bash 5.3.20 oracle while the product matches it. Each repair below was re-verified against the oracle (script files / identical PTY driver) before editing: - issue1654 x4 (adj-signals): pin signal death (code None) instead of Some(143). GNU dies BY SIGTERM in all four shapes (subprocess returncode -15); 143 is the shell-layer wait status, not a process exit code. Same correction the file's GATE-READJUDICATION A2 note already made for the control test. - issue1640 (adj-signals): GNU lets the sleep run to completion, then DISCARDS the rest of the line; the next line reports 130. Pin NEXT_130 + AFTER1640-never-runs, not "AFTER1640 rc=0". - issue438 argv_word (adj-engine): a procsub created by a bare assignment has its fd closed when the assignment completes; GNU fails identically (cat: /dev/fd/63: No such file or directory, rc 1, no output). Pin GNU's failure shape. - issue443 (adj-engine): `x=2 (echo "$x")` is a syntax error in GNU (rc 2) — an assignment prefix cannot precede a subshell. Use the file's assert_parse_error; drop the "unixwin#453 semantics" expectation. - issue127 (adj-semantics): the pin's Rust literal carried one escape level too many, writing doubled backslashes into the script. Halved to the intended single-backslash script; the expected output (\alice\miniforge3) is unchanged. - shift s4 tail (adj-semantics): `shift 1 2` takes get_numeric_arg -> no_args -> jump_to_top_level(DISCARD) (builtins/common.c:488-511, 139-151): the echo never runs; script file exits 2, -c (this harness) exits 1, stdout empty. - issue297_300 prompt-at-EOF (adj-cli): \s is the basename of the invoked binary; GNU copied to a file named `rubash` prints `rubash-5.3# exit`. Derive the expectation from CARGO_BIN_EXE_rubash instead of hardcoding `bash`. - issue431 bashit (adj-cli): the printf-built PS1 ends in an unbalanced \[, which both shells render literally once per rendered prompt. Pin GNU's fragment counts (2 open / 0 close) instead of zero. - issue773 ulimit defaults (adj-fd): 10240/1048576 were the authoring machine's ambient RLIMIT_NOFILE, not GNU constants. Read the expectation from the test process's own limits via getrlimit (unix); non-unix keeps the recorded emulation defaults. Deliberately untouched (still red, by design): issue431 inretio (PRODUCT, tracked separately), issue773 exhaustion / base-beyond-limit (PRODUCT), the five issue1639 pins (ENV-racy; which sibling fails rotates run to run). Verification (scrubbed_cargo cargo test per target): 1654 7/7, 438 8/8, 443 16/16, parse-regressions 8/8, shift 7/7, 297_300 10/10, 431 3/4 (inretio red by design), 773 5/7 (two PRODUCT reds by design), 1639_1640 6/7 (one rotating racy 1639 red). Harness note: verification ran under scrubbed_cargo but outside with-build-slot — the single build slot was held for over an hour by an environment-limited target with a deep sibling queue; the scrubbed fd hygiene was preserved, and the captain can re-run through the slot at harvest.
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 part of niubash#452(语法误拒族集群1:官方资产被拒而 GNU 接受)。根因是 token_actions.rs 对「赋值词后跟 `(`」无条件注入解析错误;审计语料(snapshots/wt92-local-20261005)记录 GNU bash -n 接受这些行——词法断词后剩下「赋值 + 子 shell」是 GNU 合法形态。修复:空值歧义形态 x= ( 仍拒;非空值放行至子 shell 分发;执行器在子 shell 作用域内应用前缀赋值(整状态保存/恢复)。18 探针 + 3 回归测试全绿,assignment 三套回归 23 用例无劣化。注意:bash bin 是转发到已装 Niubash 的垫片,测试直打 rubash 引擎。