Repository navigation
rubash#3605 run-func: rebase end_position with position in line_offset paths - #3676
Conversation
…t paths
The line_offset rebase in run_source_impl (and the matching rebases in
builtins/source, eval, debug-condition, and comsub alias-splice paths)
shifted position/column/logical_line but left end_position in the old
line space. finish_compound_command stamps a compound's end_line from
max(position, end_position) (arithmetic_command.rs), so a folded
'{ ... }' token — which spans lines and is born with
end_position == position — reported the '{' line once any nonzero
offset was applied (later groups on the grouped driver).
run-func's func5.sub takes the grouped path (script_runs_foreign_text
matches '. ' inside its license comment) and the def at lines 28-31
reported 'not a valid identifier' at line 29 (the '{') where GNU
reports 31 (the '}').
GNU anchor: execute_cmd.c:6289 execute_intern_function checks
valid_function_word at EXECUTION time and yyerror's with the ambient
line_number, which by then is the function_def's parse-END line.
Verified against GNU bash 5.3.20 (script files): '}'-line report on
fast path, grouped path, and func5.sub's full layout. New regression
file tests/issue3605_grouped_def_end_line.rs pins all three.
Refs #3605
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
【WIN-AGENT-AUDIT】 机制核查:
腿:
F 点:无 未跑/VOID 的腿:无 |
|
【WIN-AGENT-AUDIT】 机制核查:5 个重定基点(run_source_groups、comsub function_calls、trap_exec eval/DEBUG 两处、run_source_impl line_offset)把 腿:
F 点:无 合入阻断:本 PR 已 未跑/VOID 的腿:无 |
|
【WIN-AGENT-AUDIT】 处置理由(未重审内容,沿用本 PR 上一轮的 PASS 报告):
未跑/VOID 的腿:本轮未重跑内容腿(处置为冲突跳过);上一轮 PASS 报告的计数仅对旧 head 有效,rebase 后必须重跑钉自跑 + fail-first + lib 双边。 |
# Conflicts: # src/executor/function_calls.rs # src/executor/trap_exec.rs
|
【WIN-AGENT-AUDIT】PR #3676 第3轮 — CONFLICTING 已解,建议:PASS(合入待 CI 余量跑完) 冲突解法(机械,保持双方机制):
腿(逐项,对 merge 后 head 4fe3499 实测):
续作记录:
未跑/VOID 的腿:无(CI 3 项 pending 属在途,非 VOID)。 |
|
【WIN-AGENT-AUDIT】PR #3676 第3轮 — 追加:已合入 CI 跑完(head 4fe3499):红 = 按 T 波 CONFLICTING 口径合入:squash |
Summary
Fixes the
run-funcclass-B item from #3605: afunction NAMEdefinition whose{sits on the following line reported an invalid identifier at the{line instead of the definition's parse-end (}) line.Root cause. The
line_offsetrebase applied to pre-lexed tokens shiftedposition/column/logical_linebut leftend_positionin the old line space.finish_compound_commandstamps a compound'send_linefrommax(position, end_position)(src/parser/arithmetic_command.rs), so a folded{ ... }token — which spans lines and is born withend_position == position— stamped the{line once a nonzero offset was applied (later groups on the grouped script driver). Fixed at all five rebase sites:run_source_impl(script_driver.rs),builtins/sourceexecution, the eval and DEBUG-condition rebases (trap_exec.rs), and the comsub alias-splice rebase (function_calls.rs).Trigger path.
func5.subtakes the grouped driver becausescript_runs_foreign_text's textual markers match.inside its license comment (... FOR A PARTICULAR PURPOSE. See the). The def at lines 28–31 reportednot a valid identifierat line 29 where GNU reports 31.GNU anchor.
execute_cmd.c:6289 execute_intern_functionchecksvalid_function_wordat EXECUTION time andyyerrors with the ambientline_number, which by then is the function_def's parse-END line.Verified against GNU bash 5.3.20 via script files:
}-line report on the fast path, the grouped driver, and func5.sub's full layout; niubash gaterun-funcPASS on macOS arm64. New regression filetests/issue3605_grouped_def_end_line.rspins all three shapes.Refs #3605