Repository navigation
fix(startup): --debugger runs the bashdb starter and degrades like GNU - #1191
Merged
Merged
Conversation
GNU shell.c:257 maps --debugger to debugging_mode only; startup then runs the configure-baked bashdb starter (start_debugger, called for -c at :764 and for scripts/stdin at :795 behind the reading_shell_script||!interactive gate), and a missing starter warns internally and clears the mode (:1547-1566). The flag never touches extdebug — bashdb's own init does. rubash previously mapped BOTH --debug and --debugger onto extdebug in invocation.rs, a path the main binary never even reached (the parse_long_options pre-scan silently swallowed both names): a bashdb user got silent no-op, everyone else got nothing. Now: --debugger arms the mode, the four non-interactive driver entry points attempt the starter (BASHDB_START_FILE seam first — GNU bakes a per-build prefix we cannot know, Termux included — then the two conventional locations), a miss prints the GNU-shaped diagnostic pair and disables the mode, and a bare interactive shell skips the attempt exactly like shell.c:795. --debug stays the vestigial GNU flag it is (shell.c:255), accepted with no effect; #497's native debugger owns that name when it lands. Verified against the WSL GNU bash 5.3.20 oracle transcript in tests/debugger_flag_gnu_parity.rs (6 cases: miss warn+disable, seam path reporting, found-starter sourcing order, no-flag silence, --debug vestigial, stdin-script coverage).
This was referenced Oct 23, 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.
What was wrong
GNU shell.c:257 maps
--debuggertodebugging_modeonly. Startup then runs the bashdb starter file (start_debugger, shell.c:1547) at three gated sites — before-c(:764), before scripts/stdin readers (:795, behindreading_shell_script || interactive_shell == 0) — and a missing starter prints the diagnostic pair and clears the mode (:1559-1561). The flag never touches extdebug; bashdb's own init does.rubash instead mapped BOTH
--debugand--debuggerontoset extdebugin invocation.rs — a code path the main binary never reached (parse_long_optionsswallowed both names as accepted no-ops). Net effect: a bashdb user got a silent no-op;bashdbunderniu --debuggernever started; no degradation diagnostic ever fired.Now
--debugger: arms the mode; the four non-interactive drivers attempt the starter before any user command. Search order:BASHDB_START_FILE(documented seam — GNU bakes a per-build prefix we cannot know: Termux, custom --prefix), then/usr/local/share/bashdb/bashdb-main.inc, then/usr/share/bashdb/bashdb-main.inc.rubash: <path>: No such file or directory+rubash: warning: cannot start debugger; debugging mode disabled, mode cleared.shopt -s extdebugtakes effect (that IS how real bashdb arms itself), so a bashdb user upgrades in place.--debug: stays the vestigial GNU flag it actually is (shell.c:255debuggingvar, no user-visible effect). Native script debugger (rubash --debug / --dap): M0 design consensus #497's native debugger owns that name when it lands.Oracle
WSL GNU bash 5.3.20 (no bashdb installed):
rubash now emits the same shape (rubash: prefix per our naming convention), and 6 regression cases in tests/debugger_flag_gnu_parity.rs pin: miss warn+disable, seam path reporting, found-starter sourcing order (starter before -c), no-flag silence, --debug vestigial (rc anchored on echo — GNU's own
shopt -pon an OFF option exits 1, verified side by side), stdin-script coverage.lib 789 ✓ / regression 78 ✓ / fmt clean / clippy clean on touched files.