MDEV-15549 - wsrep_sst_common: fix per shellcheck#645
Merged
janlindstrom merged 1 commit intoMariaDB:10.0-galerafrom Jul 19, 2018
Merged
MDEV-15549 - wsrep_sst_common: fix per shellcheck#645janlindstrom merged 1 commit intoMariaDB:10.0-galerafrom
janlindstrom merged 1 commit intoMariaDB:10.0-galerafrom
Conversation
shellcheck -s sh wsrep_sst_common.sh
In wsrep_sst_common.sh line 258:
[ -n $3 ] && reval=$3
^-- SC2070: -n doesn't work with unquoted arguments. Quote or use [[ ]].
^-- SC2086: Double quote to prevent globbing and word splitting.
Contributor
|
Hi @grooverdan, Thanks for your contribution. Corresponding JIRA task: https://jira.mariadb.org/browse/MDEV-15549 This task was added to 10.3 backlog. Thanks, |
Contributor
janlindstrom
left a comment
There was a problem hiding this comment.
Why you need double quote inside [] but not in reval= ?
Member
Author
|
because assignment isn't shell expanded $ cat /tmp/x.sh #!/bin/sh a=$1 echo $1 $ /tmp/x.sh "a; ls" a; ls Expressions are: $ cat /tmp/x.sh #!/bin/sh [ -n $1 ] && echo onehorse [ -n "$1" ] && echo twohorse $ /tmp/x.sh dog onehorse twohorse $ /tmp/x.sh '' onehorse $ /tmp/x.sh '"" || 1' /tmp/x.sh: line 2: [: too many arguments twohorse So lets protect against all the odd things that could be used in config file variables. |
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.
POSIX shell support in 10.0-galera would require f16ead5 however this shellcheck component wasn't included.
shellcheck -s sh wsrep_sst_common.sh
In wsrep_sst_common.sh line 258:
[ -n $3 ] && reval=$3
^-- SC2070: -n doesn't work with unquoted arguments. Quote or use [[ ]].
^-- SC2086: Double quote to prevent globbing and word splitting.
I submit this under the MCA.