Skip to content

fix(executor): apply declare -i/-l/-u conversion on mapfile/read -a element stores (Refs #3659) - #3667

Merged
caomengxuan666 merged 4 commits into
masterfrom
fix/3659-mapfile-read-attr-conversion
Nov 15, 2026
Merged

caomengxuan666 merged 4 commits into
masterfrom
fix/3659-mapfile-read-attr-conversion

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Refs #3659。

UNVERIFIED-BY-CAPTAIN——队长尚未复核。

根因

mapfile(及 read -a)存入 declare -i/-l/-u 数组时跳过属性转换,原样存 raw 字符串;直接元素赋值与标量 read 已绿,因为转换只在 array_assignment_exec.rs 内联三处做,mapfile/read -a 绕过该路径直接写存储层。

GNU 锚点

修法

本 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。
  • 邻居:mapfile/read/declare 属性面 30 stem(101 格)全绿;全量 lib 头 1249/0/4,与基底逐数对齐;RUSTFLAGS="-D warnings" cargo check --lib --bins rc=0。
  • 合并形重验:fix(build): add missing closed field to two FileFd literals (Refs #3213) #3666 合入、尖恢复编译后,本分支已 update-branch 到 2e02e906,无 shim 重跑钉 12/12、-D warnings rc=0、种子 10/10。

@caomengxuan666
caomengxuan666 force-pushed the fix/3659-mapfile-read-attr-conversion branch from c2389bf to 458b09c Compare November 15, 2026 06:42
@caomengxuan666

Copy link
Copy Markdown
Member Author

队长复核 PASS(2026-11-15 14:4x,gh 核 + REPORT 全读 + diff 亲读)。

修法:variable_state.rs 新增共享 helper convert_array_element_value(整型先 evalexp、空/非数字→0,再大小写折叠,与直接赋值路径复用同一转换件);三处存储点在绑定时转换(回调仍收 raw 值):mapfile slurp 快径 + 通路循环、mapfile_helpers 增量驱动、read -a 主存点。4 文件 +46 行,纯加法(全 PR +179/−0);未碰 array_assignment_exec.rs(#3601 在动)、arrays/executor.rs(#3624 在动)、continuation.rs、api-ledger;未碰 #3660 回调面。

腿(车道实测,队长核过 REPORT 与 diff):

CI 按名(run 43686683798,队长亲读 failed 日志):3 红皆为既判基线 cell issue2875_input_procsub_child_runs_as_rubash_shell(consumer_tests.rs:3503),Rust tests / macOS / goldens 各 1 败,余皆绿;其余 7 项 pass。基底 2e02e90 的 CI run 43686396257 仍 in_progress(niu-canary 已 success),该 cell 为多轮既判基线,修法不碰 procsub-child 面,本地双边亦逐数对齐,故不拦合入。

合入轮:头已在当前尖 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.
@caomengxuan666
caomengxuan666 force-pushed the fix/3659-mapfile-read-attr-conversion branch from 458b09c to a141f9a Compare November 15, 2026 10:20
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 15, 2026 13:13
@caomengxuan666
caomengxuan666 merged commit 7686125 into master Nov 15, 2026
8 of 11 checks passed
caomengxuan666 added a commit that referenced this pull request Nov 15, 2026
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant