Repository navigation
fix(#505): multi-line [[ ]] with folded ((...)) continuations parse like GNU; readline surface residual (#431); #433 rc ledger pinned - #571
Merged
Conversation
This was referenced Oct 12, 2026
…ike GNU; readline surface residual (#431); #433 rc ledger pinned #505: rubash's lexer folds a balanced ((...)) at command position into one Keyword token; the cond collector modeled it as a single WORD operand, so the continuation-line newline before ]] surfaced in the binop slot ('conditional binary operator expected') inside function bodies. GNU's reader delivers ( as the grouping token inside [[ ]] - the arithmetic fold is gated on (parser_state & (PST_CASEPAT|PST_CONDCMD)) == 0 (parse.y:3780) - and every completed term ends with cond_skip_newlines (parse.y:5108 group close, 5140 unary, 5243 binary rhs), hiding newlines after a CLOSED GROUP. collect_conditional_args now re-splits the fold into the group token population GNU produced (except after =~, whose RHS is one word under PST_REGEXP, parse.y:5443). Acceptance: the wt92 minimal repro and sheldritch/sheldritch core/args.sh both pass -n and run like GNU. #431 residual (handover #479 rows inputrc/bind -v): bind -v/-V dump the 48-variable GNU 5.3 table; set NAME VALUE flows from bind arguments and inputrc files (GNU diagnostics, boolean/number normalization, editing-mode -> keymap coupling); inputrc parsing applies $if term=/mode= conditionals (case-sensitive, in-file set arms later blocks), $else/$endif, $include; initialize_readline reads $INPUTRC/~/.inputrc once per process on the first bind (bind.def:131) or prompt (y.tab.c:4024); positional binding failures moved to the readline: channel with no status effect (bind.def:304-333 ignores rl_parse_and_bind's return) and non-quote non-set arguments are silently ignored. reedline-upstream rows (-p/-P/-l full tables, multi-key sequences, variable behavior in the editor) documented in bind_builtins.rs. #433 ledger: final-rc parity after a trailing PC parse error (GNU 0) locked with three interactive regressions; current master already agrees.
…uote domain by construction (#571) scripts/check-utf8-boundary-hygiene.sh (landed post-rebase) flagged bind.rs:448 `delimiter: Some(d as char)`. The widened byte is the isolate_sequence delimiter, matched only against b'"' (0x22) / b''' (0x27) - ASCII by construction, never a UTF-8 continuation byte; the value is echoed in diagnostics and compared for equality (BindSpecError::delimiter). Tight allowlist entry beside the two existing bind.rs rows.
caomengxuan666
force-pushed
the
fix/legacy-505-431-433
branch
from
October 12, 2026 07:56
1e656a1 to
dd219b4
Compare
2 tasks done
caomengxuan666
added a commit
that referenced
this pull request
Oct 13, 2026
M0 design draft for rubash#497, written to be startable as-is: - Scope pinned: one debuggee topology (script in the host process, pdb/debugpy model), DAP minimal surface over stdio (launch / same-process-spawn-only attach / setBreakpoints by file:line / stackTrace / scopes / variables / evaluate / pause-continue-step). - Stop substrate anchored to the existing run_debug_trap seam family — all 11 dispatch points enumerated with file:line at 7f18b44 (trap_exec.rs:716 funnel; ast_exec.rs:541; compound_exec.rs:334/982/ 1135/1170/1232/2305; function_calls.rs:531; loop_select.rs:117; pipeline_exec.rs:672; select_exec.rs:64) plus the function-return patch point (trap_exec.rs:781) for the extdebug force-return hole. - Breakpoint injection: recommends executor PC hooks (the seam family is the PC, GNU DEBUG-trap distribution is the stop-site set, no second admission list per #117) with the parse-tree line walk (parser/nodes.rs:1252 CommandNode.line) used only for verified:false resolution at setBreakpoints time; reasons stated. - Frame/scope/evaluate reuses landed structures: funcname_stack / bash_source_stack / bash_lineno_view (dynamic_arrays.rs:683/687/409), main-frame rule (#519, dynamic_arrays.rs:389-395), ERR entry-state parity pattern (#520), function_definition_locations (function_calls.rs:495-511); extdebug surface (#569 sites, trap_exec.rs:773-775) and #571 bind -v registry as the CLI's readline foundation. - Non-goals, acceptance (golden DAP transcripts + bashdb oracle), scale estimate (~3,000-4,500 LOC, no new crates), M1 outlook, and three owner decision points (frontend order; --debug flag semantics; M0 stop-site granularity).
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.
三张老票的遗留清偿
#505 — 函数体内跨行
[[+||起始续行被拒(生态重审计唯一活缺陷)根因(vendored 源锚定):rubash 的 lexer 在命令位把平衡的
((...))折叠成单个 Keyword token;cond 收集器把它当单个 WORD 操作数,于是续行换行在 binop 槽裸露 →unexpected token 'newline', conditional binary operator expected。GNU 语义(
third_party/bash/逐行锚定):parse.y:3780read_token:(的算术命令特例门控在(parser_state & (PST_CASEPAT|PST_CONDCMD)) == 0——[[ ]]内(一律按 cond 分组 token 投递,[[ ((x == 0)) ]]是 group(group(binary))(parse.y:5094-5110cond_term)。(void)cond_skip_newlines()(parse.y:5108组闭合、:5140一元、:5243二元 RHS)——闭合组之后的换行不可见;裸词的 binop 槽是裸read_token(parse.y:5179),换行在那里照样报错(GNU 实测[[ x+ 换行 +]]同拒)。修法:
collect_conditional_args把折叠 token 重切回 GNU 读者会产出的组 token 群(=~RHS 例外——PST_REGEXP 下 RHS 是一个词,parse.y:5443)。验收(WSL GNU bash 5.3.0 双向存证):
-n通过、实跑输出IN-FUNC-OK与 GNU 一致(修前 rc=2 双拒)core/args.sh(56394 B)rubash -n通过(修前精确失败于行 1307)if/while/f() (+ 跨行 +|| ((...))续行为触发面;顶层同构本就通过[[ x+换行+]]、[[ (x) == x ]]、[[ ((x)) q ]]等仍以 GNU 同文拒收#431 残余(交接单 #479:inputrc 读取 / bind -v / inputrc 解析面)
bind -v/-V:48 变量 GNU 5.3 全表(顺序、默认值、set X V/X is set to `V'两种格式,探针逐行对齐)。set NAME VALUE:bind 参数与 inputrc 文件双通道进表;未知名readline: NAME: unknown variable name、editing-mode 坏值readline: editing-mode: could not set value to `bogus'(GNU 同文,rc 恒 0);布尔非on归off、数字垃圾归0(静默,GNU 探针);set editing-mode vi联动keymap vi-insert。$if term=/mode=条件(大小写敏感;同文件set editing-mode武装后续mode=块)、$else/$endif嵌套、$include(缺失静默)。bashline.c:451,bind.def:131/y.tab.c:4024触发):$INPUTRC→~/.inputrc每进程一次——-c下首个 bind 即生效(GNU 同),rcfile 先于 inputrc。readline: …且不影响 rc(bind.def:304-333忽略 rl_parse_and_bind 返回);-x失败保持bind:通道 rc 1;非引号非 set positional 静默忽略(GNUbind 'ls -l'rc 0)。reedline 上游清单(引擎侧已完成、需宿主编辑器接行为,已写入 bind_builtins.rs 模块文档):
-p/-P/-l全表(reedline 键表只覆盖 GNU 176 函数名的子集);超出宿主键解析器的多键序列;变量表在编辑器内的行为落点(今天宿主只消费 editing-mode/keymap,其余 46 项是数据面)。#433 记账
残账口径「PC parse-error rc=2 vs GNU 0」在现行 master 已闭合(4b6234c5 及后续):五形态探针(EOF 即错/中段错/PC 正常/无 PC/末提示符错)GNU 与 rubash 全部 rc=0 一致。本次把账锁死:三条交互回归(EOF 终局 rc=0、中段错 rc=0、PC='exit 7' 仍以 7 胜出)并入 issue433 回归文件。
测试证据
tests/issue505_multiline_cond_folded_arith_regressions.rs:15/15(含 GNU 拒收控件)tests/issue431_readline_surface_regressions.rs:18/18tests/issue433_prompt_command_exit_regressions.rs:9/9cargo test --no-fail-fast:本分支失败集 53 名 vs fresh master(eb062957)失败集 53 名,逐名双向 diff 为空(双侧同集合:command_chaining 15、bashdb_compat 13、examples 10 等环境依赖项,双侧同源)cargo fmt --check干净GNU 探针存证
全部 accept/reject 判定来自 WSL GNU bash 5.3.0(/usr/local/bin/bash,仓库基线)脚本文件探针:parse.y cond 语法 12 形、bind -v/-V 全表、set 校验 9 形、inputrc 条件/include 6 形、PC rc 5 形。