You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] Special variable $_ is never updated by command execution (: "ARG"; echo $_ keeps startup value) — pure-bash-bible trim_string/urlencode corrupt #321
Found by ecosweep3 lane (pure-bash-bible corpus, sections 001/013; carrier release build of 6106961).
Reproducer (target/probe-out/p1.sh)
:"ARGVAL"echo"[$_]"
GNU bash 5.3.0 (WSL, script file): [ARGVAL]
rubash: [./release/rubash.exe] (startup value of $_; never updated)
Impact (corpus evidence)
pbb trim_string: : "${1#...}"; printf '%s\n' "$_" prints the timeout.exe path instead of the trimmed string (section 001).
pbb urlencode: for ((...)); do : "${1:i:1}"; case "$_" in ... — $_ stays at the last local LC_ALL=C argument ("C"), so every character percent-encodes as %43 (section 013).
GNU anchor
execute_cmd.c:4194var = bind_variable ("_", arg, 0); (also 4181 read site): after each simple command bash binds $_ to the last word of the expanded command. variables.c sv table owns the export side.
Expected
$_ tracks the last argument of the last executed simple command (incl. : builtins and assignment-prefixed commands).
Fixed by wt14/pbbfix (77d49f8, master): $_ was bound only into env_vars (shadowed by the typed variable store), pure assignments never bound the empty string, function calls did not rebind to the invocation word, and bare ((...)) bound )) - the full GNU bind-point coverage ported (execute_cmd.c:4746/4943/4188 incl. the NULL-binds-empty-string rule at :4638, variables.c:543). 14-form command matrix + comsub/subshell isolation + pbb trim_string/urlencode end-to-end byte-identical. Whole-suite failure set moved 258 -> 257 with the single delta being an existing RED test turning GREEN.
Activity
docs(corpus): ecosweep3 lane - pbb per-snippet, zlib/libpng/FFmpeg co…
fix(#321): $_ tracks the last executed word - dual-store bind + GNU b…
fix(#322): unquoted [[ =~ ]] regex - token-initial # inside the RHS w…
caomengxuan666 commentedon Sep 29, 2026
Fixed by wt14/pbbfix (77d49f8, master): $_ was bound only into env_vars (shadowed by the typed variable store), pure assignments never bound the empty string, function calls did not rebind to the invocation word, and bare ((...)) bound )) - the full GNU bind-point coverage ported (execute_cmd.c:4746/4943/4188 incl. the NULL-binds-empty-string rule at :4638, variables.c:543). 14-form command matrix + comsub/subshell isolation + pbb trim_string/urlencode end-to-end byte-identical. Whole-suite failure set moved 258 -> 257 with the single delta being an existing RED test turning GREEN.