Repository navigation
fix: allexport marks — scalar over indexed array; declare compound in function (Refs #2963 #2964) - #2977
Merged
Conversation
caomengxuan666
marked this pull request as ready for review
November 7, 2026 10:38
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.
Refs #2963
Refs #2964
范围
r79 残余两面,同属
set -a(allexport / mark_modified_vars)标记族:-x。GNU 锚点:该绑定仍走bind_variable_internal(variables.c:3054),其数组臂把值存入 element 0(variables.c:3195-3205),尾部if (mark_modified_vars) VSETATTR (entry, att_exported)(variables.c:3211-3212;mark_modified_vars = flags.c:47,167)。rubash 的 indexed 臂在 allexport 时把存储渲染投影进进程 env(set_process_env,只镜像特殊名、对普通名是 no-op),从未置 EXPORTED 属性位;assoc 孪生臂走mark_exported是对的。修法:indexed 臂与 assoc 臂同形,改走mark_exported。declare arr=(1 2)被误标-ax。GNU 锚点:函数内 declare_internal 是 local 语境,复合操作数经本地数组机器创建 +do_compound_assignment(subst.c:3441,ASS_MKLOCAL)转换,两者都不打标;顶层产生怪癖的 ASS_FORCE 创建预绑定在函数内不发生。函数内标量操作数仍经bind_variable_value(variables.c:3320)绑定并在其尾部打标(variables.c:3366-3367)。rubash 的 declare allexport post-pass(execute_declare 的 [export] 前缀赋值过持久 + allexport 不打标无值声明:FOO=val export BAR 后 FOO 残留(GNU unset);set -a declare v 无 -x (P2) #538 模拟)对所有带值操作数一律打标,无函数语境区分;execute_local 的 post-pass([bug] set -a (allexport) ignored by local/readonly initialization #2944)已对复合值退让。修法:declare post-pass 在 local 语境(function_depth > 0且无-g)下,对复合操作数(带 W_COMPASSIGN 载体或目标已是数组的(...)值,与 declare.def:935-947 的复合判定同形)退让;标量与引号括号字面量照常打标。两处均为机制修:标记只由 GNU 的标量 bind 原语产生,复合/元素 bind 不产生——不在症状点加特判。
钉(fail-first 已记数)
tests/issue2963_allexport_scalar_over_indexed_array_regressions.rs(8 钉):master 上 5 过 / 3 败(败者 = 标量覆写 indexed 的三种成形:下标成形、复合创建后覆写、declare -a创建后覆写);对照含 assoc 孪生、预先 export、append、无 set -a、下标单独绑定。tests/issue2964_declare_compound_in_function_allexport_regressions.rs(10 钉):master 上 6 过 / 4 败(败者 = 函数内 declare/typeset 复合、覆写全局数组的复合、append 复合);对照含顶层怪癖-ax、函数内标量-x、local 复合、declare -g复合、引号括号标量、declare -a调用级退让。本 PR 删除了什么
set_process_env调用):该臂改走属性位mark_exported,与 assoc 臂同形。除此之外无删除——两处均为既有机制内的臂内修正(declare post-pass 增加 local 语境的复合退让、赋值臂改标记通道),无文件删除、无账本改动、无src/lexer/continuation.rs改动。declare_local.rs+45、temporary_assignments.rs+11/−1),钉两文件 +223(issue2963…100 行、issue2964…123 行)。修后账(车道自测,待队长复核)
rustfmt --edition 2021 --check四文件全清(declare_local.rs 的一处偏差在车道 hunk 内、已格式化);RUSTFLAGS="-D warnings" cargo check --locked --lib --bins无 error/warning。UNVERIFIED-BY-CAPTAIN — 队长中央复核为准。