Repository navigation
fix(declare): render FUNCNAME listings from the live call stack (Refs #2770) - #3466
Conversation
…2770) GNU ground: FUNCNAME is a dynamic array cell (variables.c:1835-1839 init_funcname_var: INIT_DYNAMIC_ARRAY_VAR, att_invisible|att_noassign); make_funcname_visible (variables.c:1812-1824) clears att_invisible at function entry, and print_var_list (variables.c:1066-1073) skips invisible cells. Rubash rendered listings from the init mirror (a birth snapshot function entry never refreshes) and the #183 seed hack fabricated a cell after unset. - dynamic_arrays.rs: FUNCNAME joins the array declaration class, the dynamic cell view, the set-view supply (non-empty stacks only), and a dedicated declaration view rendering the composed stack. - declare_local.rs: the named-print seed never seeds a lifetime-unset cell; FUNCNAME joins the VISIBLE listing-refresh class with GROUPS/BASH_SOURCE/BASH_LINENO. - tests: new stem issue2770_funcname_listing_regressions (3 tests: top-level named/listing/filter forms, in-function live stack incl. nested, unset removes the view), byte-verified against GNU bash 5.3. - ci.yml: named nextest step for the new stem (outside every CI lane otherwise, rubash#3430). UNVERIFIED-BY-CAPTAIN
Captain review — PASS ✅Reviewed head GNU ground — re-verified in vendored bash 5.3, not taken on citation: Captain's own legs (X299-2607 + box + local):
CI adjudication: final-head CI's three red jobs are all the Intersection: only Two citation nits (non-blocking, no rework requested): the new comment/pin cite Merge round: ready + update-branch, confirm the merged head's census step runs the issue2770 stem green and no new CI failure names appear, squash with this PR's body verbatim. #2770 stays open (Refs-only) — closed manually after merge. |
根因
FUNCNAME 在
declare/set各类 listing 里没有 live view:PR #2766 把动态变量的 listing 改为 registry 驱动后,FUNCNAME 的 listing 仍渲染 init mirror——一个 birth snapshot(""函数入口,从不刷新),而不是实时调用栈;且 #183 的 seed hack 会在unset后凭空造出一个 cell。GNU 锚点(vendored bash 5.3)
variables.c:1835-1839init_funcname_var:INIT_DYNAMIC_ARRAY_VAR ("FUNCNAME", get_funcname, null_array_assign)+att_invisible|att_noassign。variables.c:1812-1824make_funcname_visible:函数入口清att_invisible,返回时重设。variables.c:1066-1073print_var_list:跳过att_invisiblecell——depth 0 的 baredeclare/set无行,可见后渲染 live stack。builtins/setattr.def:510-511show_var_attributes:invisible array 印 bare 名(depth 0 为declare -a FUNCNAME),可见后带元素。variables.c:3788unbind_variable:unset后 cell 在本 shell 生命周期内消失,declare -p FUNCNAME报 not found。改动
src/executor/dynamic_arrays.rs:FUNCNAME 加入 array declaration class、dynamic cell view、set-view supply(仅非空栈)、以及从 composed stack 渲染的专用 declaration view。src/executor/declare_local.rs:named-print seed 永不 seed lifetime-unset 的 cell;FUNCNAME 加入 VISIBLE listing-refresh 类(与 GROUPS/BASH_SOURCE/BASH_LINENO 同列)。tests/issue2770_funcname_listing_regressions.rs(新 stem,3 tests):顶层 named/listing/filter 形、函数内 live stack(含嵌套)、unset 后 view 消失;期望与 GNU bash 5.3 oracle 逐字节一致。.github/workflows/ci.yml:新 stem 的 named nextest 步(该 stem 在其他 CI lane 之外,rubash#3430)。本 PR 删除了什么
无产品代码删除。仅重组:FUNCNAME 的 listing 渲染从 stale env mirror 改为 live provider view;
declare_local.rs的 seed 条件收窄(unset 后不再造 cell)。验证(UNVERIFIED-BY-CAPTAIN)
RUSTFLAGS="-D warnings"check、GNU oracle 三方、相邻 issue2700 族 stem。Refs #2770