Repository navigation
fix(executor): by-name BASH_ARGV0 reads materialize the listing cell (Refs #3026) - #3708
Merged
Merged
Conversation
…(Refs #3026) GNU's BASH_ARGV0 is an ordinary INIT_DYNAMIC_VAR (variables.c:1850) — never att_invisible — and is absent from print_var_list only while its value cell is NULL (print_assignment's early return, variables.c :1097-1100). Every find_variable read fires get_bash_argv0, whose set_string_value (variables.c:1520-1524) binds dollar_vars[0] into the cell, so `declare -p BASH_ARGV0` (declare.def:806 -> find_variable) makes later `typeset`/`set`/`declare` listings show `BASH_ARGV0=<v>` — and the stored snapshot even survives a later `BASH_ARGV0=` rebind, whose assign_bash_argv0 writes dollar_vars[0] without touching the cell. Rubash marked BASH_ARGV0 INVISIBLE to stand in for the unset cell, but nothing ever recorded the getter's store, so the listing stayed empty after the named read. dynamic_parameter_value now records the store in dynamic_cells.values like the other getter-backed scalars; the assignment-form listing supply (dynamic_set_views) and the declaration cell view both render that recorded cell, with a `scalar` flag on DynamicSetView so the scalar storage isn't rendered through array_to_assign. unbind_variable destroys the cell (variables.c:3839), so `unset BASH_ARGV0` drops the stored value and the INVISIBLE stand-in — a later rebind is an ordinary visible variable, matching GNU. WSL GNU bash 5.3.20 script-file verified: the materialization chain, `BASH_ARGV0=` non-materializing assign, unset+declare not-found, readonly/export/typeset operand materialization, unset+rebind relist, subshell isolation, and the stale-snapshot-after-rebind quirk all match byte-for-byte. Pin: tests/issue3026_typeset_listing_argv0_groups 3/3. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This was referenced Nov 15, 2026
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.
Summary
BASH_ARGV0is an ordinaryINIT_DYNAMIC_VAR(variables.c:1850) — neveratt_invisible— and is absent fromprint_var_listonly while its value cell is NULL (print_assignmentearly return, variables.c:1097-1100). Everyfind_variableread firesget_bash_argv0→set_string_value(variables.c:1520-1524), bindingdollar_vars[0]into the cell, so a named read (declare -p BASH_ARGV0,$BASH_ARGV0,typeset/export/readonlyoperands) makes latertypeset/set/declarelistings showBASH_ARGV0=<v>.INVISIBLEas the unset-cell stand-in but never recorded the getter's store, sodeclare -p BASH_ARGV0printed the value yet the cell3typesetlisting stayed empty.dynamic_parameter_valuenow records the store indynamic_cells.valueslike the other getter-backed scalars;dynamic_set_views(assignment form) anddynamic_cell_view(declaration form) render the recorded cell. NewDynamicSetView.scalarflag keeps scalar storage out ofarray_to_assign.unset BASH_ARGV0drops the stored cell + the INVISIBLE stand-in (unbind_variable, variables.c:3839), so a later rebind is an ordinary visible variable — matching GNU.GNU-faithful edges verified (WSL bash 5.3.20, script-file probes)
BASH_ARGV0=zzzalone does NOT list (assign_bash_argv0 swallows the bind; cell stays unset)echo $BASH_ARGV0,declare -p,typeset/export/readonlyname operands materialize → listedBASH_ARGV0=zzz; echo $BASH_ARGV0>/dev/null; BASH_ARGV0=yyy; typesetlistszzzunset BASH_ARGV0; declare -p→ not found;unset; BASH_ARGV0=zzz→ relisted as plain varTest plan
cargo test --test issue3026_typeset_listing_argv0_groups— 3/3env_clearPATH-bound (grepunresolved, identical on the e81a1af base binary)cargo test --lib— 1355/1356 (issue2084 env-bound: passes with WINUXSH_ROOT/BASH_ENV unset; passes on CI)Generated with Devin