Skip to content

fix(runner): stop get_function_line_number clobbering caller extdebug#808

Merged
Chemaclass merged 1 commit into
mainfrom
fix/get-function-line-number-extdebug-leak
Jul 15, 2026
Merged

fix(runner): stop get_function_line_number clobbering caller extdebug#808
Chemaclass merged 1 commit into
mainfrom
fix/get-function-line-number-extdebug-leak

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

bashunit::helper::get_function_line_number enabled extdebug and then ran shopt -u extdebug in the caller's shell, so a caller that already had extdebug on was silently left with it off.

💡 Changes

  • Enable extdebug only inside the subshell that reads the declaration, leaving the caller's setting untouched.
  • Parse the line number from declare -F output with shell word-splitting instead of forking awk.
  • Adds a regression test for the state leak. Fixes the leak and removes one fork per lookup.

get_function_line_number ran 'shopt -s extdebug' then 'shopt -u extdebug' in
the caller's shell, so a caller that already had extdebug enabled was silently
left with it disabled. Enable it only inside the subshell that reads the
declaration, and parse the line number from 'declare -F' output with shell
word-splitting instead of forking awk.

Fixes the state leak and removes one fork per lookup.
@Chemaclass Chemaclass added the bug Something isn't working label Jul 15, 2026
@Chemaclass Chemaclass self-assigned this Jul 15, 2026
@Chemaclass Chemaclass merged commit 830930a into main Jul 15, 2026
37 checks passed
@Chemaclass Chemaclass deleted the fix/get-function-line-number-extdebug-leak branch July 15, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant