Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.2: Don't allow "info args n" to use n outside the valid range #43

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

jansorg
Copy link
Collaborator

@jansorg jansorg commented Oct 9, 2024

The max value of n is one less than the current stack depth. info args 0 prints the arguments of stack item ##1.
This PR also does a minor cleanup of args.sh.

Without this fix, an error would be printed:

bashdb<0> info stack
->0 in file `/home/jansorg/test.sh' at line 1
##1 source("/home/jansorg/test.sh") called from file `./bashdb' at line 107
##2 main("-L", ".", "/home/jansorg/test.sh") called from file `./bashdb' at line 0

bashdb<1> info args 2
./command/info_sub/args.sh: Zeile 78: ((: r = r +  : Syntaxfehler: Operator erwartet. (Fehlerverursachendes Zeichen ist "+  ").
Argument count is 0 for this call.

(The error is in German and says "syntax error: expected operator")

Max value of n is one less than the current stack depth.
@jansorg jansorg requested a review from rocky October 9, 2024 09:57
@jansorg jansorg changed the title Don't allow "info args n" to use n outside the valid range 5.2: Don't allow "info args n" to use n outside the valid range Oct 9, 2024
@rocky
Copy link
Collaborator

rocky commented Oct 9, 2024

LGTM - Thanks!

@rocky rocky merged commit b42e3cc into bash-5.2 Oct 9, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants