Skip to content

fix6: mopup-a — eval diag routing, script-file BASH_FUNC import, time errexit report, arith array assign (#1609 #1610 #1611 #1614) - #1663

Merged
caomengxuan666 merged 4 commits into
masterfrom
fix6/slice-mopup-a
Oct 25, 2026
Merged

caomengxuan666 merged 4 commits into
masterfrom
fix6/slice-mopup-a

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

第六波补遗簇(mopup-a)四条修复,自基线 f6b5a3f 的簇提交 cherry-pick 至当前 master,逐条完整修复:

Fixes #1609
Fixes #1610
Fixes #1611
Fixes #1614

验证账

簇侧已过(基线 f6b5a3f,集成树复跑中/待跑,逐项以集成复验为准):

  • 新回归 4 文件 23/23 PASS(1609: 3、1610: 3、1611: 11、1614: 6);[bug] set -e on a time command discards the timing report (residual of #1278) #1611 的 24 格形态矩阵与 GNU 5.3.20 oracle 逐格一致
  • 邻近 28 套件 241/241 PASS(time/parsetime、extglob/eval、算术/数组、trap/env 族)
  • lib 全量 771/1/1(唯一失败 = 允许项 ownership_unary_operators_check_existing_file,root 环境项)
  • 差分 306 例 304 PASS(见口径注记)

集成树复验(pick 至 d15a02d,零冲突,diff 与簇侧逐字一致 +785/−51、改动文件 CR 0)由集成报告逐项回填。

口径注记

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).
@caomengxuan666

Copy link
Copy Markdown
Member Author

集成复验完成(集成树 = 本 PR head a89872d,基线 master d15a02d;构建过 build-queue 单一槽位,配方 JOBS=1 / debuginfo=0 / 净化环境):

四门全绿,可合并。集成报告:workspace rubash-fix6/integration/SLICE-MOPUP-A-REPORT.md。

@caomengxuan666
caomengxuan666 merged commit 9f9cefc into master Oct 25, 2026
7 of 10 checks passed
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.
caomengxuan666 added a commit that referenced this pull request Oct 27, 2026
@caomengxuan666
caomengxuan666 deleted the fix6/slice-mopup-a branch October 30, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant