Repository navigation
fix6: mopup-a — eval diag routing, script-file BASH_FUNC import, time errexit report, arith array assign (#1609 #1610 #1611 #1614) - #1663
Merged
Conversation
Parse diagnostics were emitted with raw eprintln! in report_command_parse_error (src/executor/public_accessors.rs) and in the command_parse_diagnostics arms (src/executor/command_execute.rs), landing on the process stderr even when the caller had redirected fd 2 (`eval '...' 2>&1`, `exec 2>file`). GNU parser_error / report_error (error.c) write to fd 2 as currently bound, and an eval string is parsed only after the builtin's redirections are in place, so the diagnostic follows them. Route every parse-diagnostic line in both funnels through the existing write_diagnostic_fd2 dispatcher (the rubash#167 mechanism), which resolves the live fd-2 endpoint. Residual of Regression: tests/issue1609_eval_parse_diag_routing_regressions.rs (2>&1 routing, 2>/dev/null silencing, exec 2>file capture).
The in-process script child (execute_direct_shell_script) rebuilt its environment with child_shell_environment(), which serialized only EXPORTED_VARS and never materialized exported functions as BASH_FUNC_<name>%% entries — unlike the real spawn path (apply_exported_functions_to_child). The fresh shell's import_exported_functions_from_env therefore found nothing and the function table started empty. GNU make_env_array_from_var_list (variables.c) carries exported functions across the boundary. Materialize the entries in child_shell_environment() in the spawn path's exact shape, and strip successfully imported BASH_FUNC_* entries from the child's env map after import (variables.c: a successful import becomes a function, not a variable — the same cleanup Executor::new performs at process startup). Residual of #1275. Regression: tests/issue1610_script_file_function_import_regressions.rs (direct script child, two-stage re-export chain, no lingering BASH_FUNC_* variable).
GNU execute_time_command completes and prints its report (print_time_info) for any inner command that returns to it; the errexit jump is adjudicated by execute_time_command's caller. Only a return unwinding through the frame abandons the report. rubash converted a completed inner command's failing status into Err(ExecuteError::ExitCode) at the dispatch layer (execute_materialized_command's tail, the subshell/null-command/ redirect-failure arms of execute_command), and execute_time_ast_command returned early on any Err, dropping the report for external, builtin, subshell, and brace-group inners. - Mark dispatch conversions of Ok completions (errexit_status_converted); a marked ExitCode completes the timed command and flows through the existing queue/print and caller-side trap/errexit adjudication. - While a timed dispatch runs (timed_dispatch_depth), conversion sites do not fire the ERR trap; the ast_exec time branch performs the single adjudication (the #1277 design), so the trap still fires exactly once. - Unmarked ExitCode unwinds (the exit builtin, also through eval/groups/functions) and break/continue print the report immediately, then propagate — GNU prints for both; parse- diagnostic ExitCodes are excluded via the parse-error latch (the command never executed). Return keeps the drop. - Pure time chains (time time ..., time (time ...)) delegate the report to the innermost frame: GNU prints exactly one. Residual of #1278. The parse-time verdict frozen by #1520 is untouched. Regression: tests/issue1611_time_errexit_report_regressions.rs (11 tests: both report forms, inner-shape matrix, ERR trap single-fire, exit/break print, return-crossing drop).
An unsubscripted array name in arithmetic denotes element 0 for writes as well as reads (GNU expr.c): $((a=7)) on a=(10 20 30) must leave a=([0]="7" [1]="20" [2]="30"). rubash's arithmetic set_variable ended in a plain env insert of the scalar text, rebinding the name and destroying every element past index 0. Route the bind in set_variable: a name marked ARRAY_VARS writes through set_array_element(name, 0, value); a name marked ASSOC_VARS writes key "0" through set_assoc_element — the same bookkeeping as a subscripted write. Only the arithmetic WRITE path changes; the perf-arrays cell-view read path is untouched. Regression: tests/issue1614_arith_array_scalar_assign_regressions.rs (seed form, compound/increment/let forms, sparse and empty arrays, associative key "0", nameref and for-loop forms).
Member
Author
|
集成复验完成(集成树 = 本 PR head a89872d,基线 master d15a02d;构建过 build-queue 单一槽位,配方 JOBS=1 / debuginfo=0 / 净化环境):
四门全绿,可合并。集成报告:workspace |
This was referenced Oct 25, 2026
caomengxuan666
added a commit
that referenced
this pull request
Oct 27, 2026
…pin
Main-session ruling: the old !stdout.contains("m1") assertion is an unsatisfiable wrong-pin construction. The eval parse diagnostic's offending-line echo itself contains the literal text `echo m1`, so the GNU-shaped (correctly routed) diagnostic always trips a substring check even though m1 was never executed. Mirror the #1663 companion pin (tests/issue1609_eval_parse_diag_routing_regressions.rs:43-45), which already documents this and uses a whole-line assertion: !stdout.lines().any(|line| line == "m1"). Discriminating power is preserved: m1 as a standalone executed output line is still caught. No other assertion changed, no product code touched; the pin's #[ignore] is removed so it runs for real now that the #1609 diagnostic routing fix (via #1663) is in.
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.
第六波补遗簇(mopup-a)四条修复,自基线 f6b5a3f 的簇提交 cherry-pick 至当前 master,逐条完整修复:
2>&1:解析诊断两处用裸eprintln!直写进程 stderr,绕过活 fd-2 绑定;改走既有write_diagnostic_fd2漏斗按 fd 表端点分发。BASH_FUNC_*:进程内脚本子路径重建子环境时只序列化导出变量,从不物化导出函数条目;补与 spawn 路径同形的物化循环,导入成功后剥除原始条目(与启动路径同形)。set -e在time上触发时计时报告整份丢失:内层已完成命令的失败状态在分发层被转成Err(ExitCode),time 帧对任何 Err 一律早退丢报告;加「errexit 已转换」标记 + timed 分发深度门,time 帧按 GNU 形态矩阵裁定打印/传播(return穿越为唯一不印类)。Fixes #1609
Fixes #1610
Fixes #1611
Fixes #1614
验证账
簇侧已过(基线 f6b5a3f,集成树复跑中/待跑,逐项以集成复验为准):
ownership_unary_operators_check_existing_file,root 环境项)集成树复验(pick 至 d15a02d,零冲突,diff 与簇侧逐字一致 +785/−51、改动文件 CR 0)由集成报告逐项回填。
口径注记
#[ignore]GNU 期望钉(issue1114/1275/1278)尚在 PR test: W3 probe-port backfill, first half — 52 regression files (bf-w3-a) #1613(未合并)中、不在 master;其去 ignore 待 test: W3 probe-port backfill, first half — 52 regression files (bf-w3-a) #1613 合入后在补测线执行。本 PR 的四条修复已另写同形断言的回归测试,覆盖不缺。