-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Use Bash arrays for argument lists in shell scripts #10877
Conversation
…DEBUGGER - There are ways to fix the warning properly but they're all less readable than this in my opinion.
37b0f80
to
cba6e68
Compare
I think I can mark this as ready for review without extra manual testing because all the modified scripts in this PR do run in CI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I wonder if it's worth all these efforts to write this in bash :)
if [ -n "$log_directory" ] | ||
then | ||
if [ -n "$optimize" ] | ||
then | ||
log=--logger=JUNIT,error,$log_directory/opt_$vm.xml | ||
log+=("--logger=JUNIT,error,$log_directory/opt_$vm.xml") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=
should work here as well, right?
Just asking, doesn't need any changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, for not getting back to this one earlier :)
Yeah, it would work and it would match the original code better but I think that +=
is more appropriate here. If log
were initialized with a non-empty array, we'd likely want to add to it rather than ovewrite it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries!
Depends on #10585.
This PR fixes shellcheck warnings about missing quotes in cases where they can contain spaces and are unquoted on purpose (to rely on Bash word splitting behavior). The solution is to use Bash arrays.