Repository navigation
fix(executor): apply declare -i/-l/-u conversion on mapfile/read -a element stores (Refs #3659) - #3667
Conversation
c2389bf to
458b09c
Compare
|
队长复核 PASS(2026-11-15 14:4x,gh 核 + REPORT 全读 + diff 亲读)。 修法:variable_state.rs 新增共享 helper 腿(车道实测,队长核过 REPORT 与 diff):
CI 按名(run 43686683798,队长亲读 failed 日志):3 红皆为既判基线 cell 合入轮:头已在当前尖 2e02e90 上,无需 update-branch(尖若移动则重算交集再做);合入前在头上重跑邻居 30 stem + 全量 lib 双边( lane 在合并形上只重验了钉/-D warnings/种子),绿了队长合。#3659 仍 OPEN(Refs-only)。 |
…lement stores (Refs #3659) GNU make_variable_value (variables.c:2905) is the single conversion point for an element store: integer arrays evaluate the value arithmetically, -l/-u/-c fold case. mapfile (both drivers) and read -a stored raw values, bypassing the conversion that direct element assignment applies inline. Share one helper (variable_state.rs) and convert at the three store sites; mapfile -C callbacks still receive the raw record.
458b09c to
a141f9a
Compare
fix(executor): re-derive POSIX mode on POSIXLY_CORRECT bind (Refs #3661) GNU `sv_strict_posix` (variables.c:5820, 6257-6266) fires on every bind/unbind of POSIXLY_CORRECT, not only on `set -o posix`. rubash split the two directions: `apply_posix_mode_transition` keeps the `set -o` path's variable binding; new `sync_posix_mode_from_variable` only re-derives the mode and never writes the variable. Hooks sit at every bind/unbind funnel. Written-text keying (expr.c:352, printf.def:112-113): arithmetic-element and printf-element spellings do NOT flip the mode; statement-element and declare/local-element operands DO. Refs #3661 (the #2902 §2 gate: modernish dies rc=128 in capability detection because a runtime `POSIXLY_CORRECT=1` assignment never armed posix mode). #3661 stays open until the captain hand-closes it on this merge; the #2902 re-run is dispatchable after that. ## 本 PR 删除了什么 No product code or files are deleted. The fix commit is +194/−3 across 12 source files (the −3 is the refactored transition body in `options.rs`). The nail-correction commit rewrites the expectations of 4 existing nail cells and the file header's probe summary, per GNU-oracle evidence; no nail cell was removed (one was added: `temp_prefix_special_builtin_persists`). ## Captain verification (merge round R4, head 5e816ac, base 35437c4) - Pin `issue3661_posixly_correct_runtime_hook_regressions`: 21/21 green on the merged shape (fail-first banked at delivery: 17 red / 3 green on base; GNU oracle matrix 25/25 SAME; neighbors 20 stems / 55 cells banked). - `RUSTFLAGS="-D warnings" cargo check --locked --lib --bins`: rc=0, zero warnings. `rustfmt --check` on all 13 changed .rs files: rc=0. - Full lib bilateral banked at delivery: 1249/0/4 both sides, failure name-set diff empty. - CI on the R4 head (run 43723537799, head == 5e816ac): 3 failing jobs (Rust tests, Rust tests (macOS), GNU regression goldens and canaries), each failing ONLY on the issue2875 baseline cell (`api::consumer_tests::issue2875_input_procsub_child_runs_as_rubash_shell`); niu-canary success. PASS comment 6894681605 stands. - Intersection (merge-base 2e02e90..35437c4 vs the PR's 13 files): exactly the 3 captain-released files — command_prepare.rs (tip #3482, ~3,900 lines apart), temporary_assignments.rs (tip #3683 @@ -827 vs PR @@ -1460, ~600 lines, different functions), variable_state.rs (tip #3667 pure insertions in different functions). Rebase clean, zero conflicts. - Zero-intersection exception for the tip move after R4: the tip moved 35437c4 -> fc1b848 (user merged #3682, Refs #3189) while R4's legs were banked; the increment touches exactly one file, `src/executor/conditional/extglob.rs`, which is not among the PR's 13 files (programmatic intersection: 0). The merged tree is therefore the R4-verified shape plus #3682's file only; no update-branch re-verify round is required. #3682's own CI was captain-named baseline-only (run 43721665167).
Refs #3659。
UNVERIFIED-BY-CAPTAIN——队长尚未复核。
根因
mapfile(及read -a)存入declare -i/-l/-u数组时跳过属性转换,原样存 raw 字符串;直接元素赋值与标量read已绿,因为转换只在array_assignment_exec.rs内联三处做,mapfile/read -a 绕过该路径直接写存储层。GNU 锚点
variables.c:2905 make_variable_value:唯一转换点——-i时evalexp(value)后itos,否则-l/-u/-c时sh_modcase。arrayfunc.c:166 make_array_variable_value->make_variable_value;mapfile.def:204-209每行bind_array_element;read.def:976assign_array_var_from_word_list。mapfile.def:195-203回调收 raw 行、绑定在后——本修法不碰回调面([bug] mapfile -C callback reading mapfile's stdin sees EOF instead of the next unread line (GNU interleaves) #3660 另案)。修法
src/executor/variable_state.rs新增共享 helperconvert_array_element_value(整型求值eval_integer_assignment_value+ 大小写折叠apply_case_assignment_attributes,与直接赋值路径复用同一转换,不另写一份)。mapfile_builtin.rsslurp 快径 + 通路循环、mapfile_helpers.rs增量驱动、read_builtin.rsread -a主存点。array_assignment_exec.rs(open PR fix: sever BASH_ALIASES/BASH_CMDS dynamic link on unset or whole-name bind #3601 在动)、arrays/executor.rs(open PR fix(executor): thread quote context into the #/% silent gate for list subjects #3624 在动)、src/lexer/continuation.rs、docs/api-ledger.md。本 PR 删除了什么
未删除任何东西。只新增一个共享 helper 与 12 格回归钉。
验证(详见工作区 REPORT.md)
tests/issue3659_mapfile_read_attr_conversion.rs:基底 fail-first 2 绿 10 红;修后 12/12 绿。seed_r123a.sh:GNU 5.3.20 10/10,修后 rubash 10/10。RUSTFLAGS="-D warnings" cargo check --lib --binsrc=0。closedfield to two FileFd literals (Refs #3213) #3666 合入、尖恢复编译后,本分支已 update-branch 到2e02e906,无 shim 重跑钉 12/12、-D warningsrc=0、种子 10/10。