Skip to content

fix(action): correct input validation script behavior#308

Closed
jerop wants to merge 1 commit intomainfrom
fix/validate-inputs-script
Closed

fix(action): correct input validation script behavior#308
jerop wants to merge 1 commit intomainfrom
fix/validate-inputs-script

Conversation

@jerop
Copy link
Copy Markdown
Contributor

@jerop jerop commented Sep 18, 2025

The input validation script was failing silently and incorrectly when exactly one authentication method was provided. This was due to the interaction between 'set -e' and the exit code of Bash arithmetic evaluation.

The post-increment expression 'auth_methods++' evaluates to 0 when auth_methods is 0. In Bash, an arithmetic expression that evaluates to 0 returns an exit code of 1. With 'set -e' enabled, this non-zero exit code caused the script to exit as if an error had occurred.

This commit changes the post-increment to a pre-increment '++auth_methods'. This ensures the expression always evaluates to a non-zero value (1, 2, or 3), resulting in a 0 exit code and preventing the script from failing.

Additionally, the '-x' flag has been added to the 'set' command to enable xtrace, which will print commands as they are executed. This improves the debuggability of the script.

The input validation script was failing silently and incorrectly when exactly one authentication method was provided. This was due to the interaction between 'set -e' and the exit code of Bash arithmetic evaluation.

The post-increment expression 'auth_methods++' evaluates to 0 when auth_methods is 0. In Bash, an arithmetic expression that evaluates to 0 returns an exit code of 1. With 'set -e' enabled, this non-zero exit code caused the script to exit as if an error had occurred.

This commit changes the post-increment to a pre-increment '++auth_methods'. This ensures the expression always evaluates to a non-zero value (1, 2, or 3), resulting in a 0 exit code and preventing the script from failing.

Additionally, the '-x' flag has been added to the 'set' command to enable xtrace, which will print commands as they are executed. This improves the debuggability of the script.
@jerop jerop requested review from a team as code owners September 18, 2025 20:05
@jerop jerop closed this Sep 18, 2025
@jerop jerop deleted the fix/validate-inputs-script branch September 18, 2025 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant