Include [] as glob chars to warn about quoting for

This commit is contained in:
Vidar Holen 2015-03-19 18:29:47 -07:00
parent 8e554ae3d4
commit 80cf5d9852
1 changed files with 2 additions and 1 deletions

View File

@ -2365,6 +2365,7 @@ prop_checkSpacefulness21= verifyNotTree checkSpacefulness "select foo in $bar; d
prop_checkSpacefulness22= verifyNotTree checkSpacefulness "echo $\"$1\"" prop_checkSpacefulness22= verifyNotTree checkSpacefulness "echo $\"$1\""
prop_checkSpacefulness23= verifyNotTree checkSpacefulness "a=(1); echo ${a[@]}" prop_checkSpacefulness23= verifyNotTree checkSpacefulness "a=(1); echo ${a[@]}"
prop_checkSpacefulness24= verifyNotTree checkSpacefulness "a='a b'; cat <<< $a" prop_checkSpacefulness24= verifyNotTree checkSpacefulness "a='a b'; cat <<< $a"
prop_checkSpacefulness25= verifyTree checkSpacefulness "a='s/[0-9]//g'; sed $a"
checkSpacefulness params t = checkSpacefulness params t =
doVariableFlowAnalysis readF writeF (Map.fromList defaults) (variableFlow params) doVariableFlowAnalysis readF writeF (Map.fromList defaults) (variableFlow params)
@ -2425,7 +2426,7 @@ checkSpacefulness params t =
T_DoubleQuoted _ w -> isSpacefulWord spacefulF w T_DoubleQuoted _ w -> isSpacefulWord spacefulF w
_ -> False _ -> False
where where
globspace = "*? \t\n" globspace = "*?[] \t\n"
containsAny s = any (`elem` s) containsAny s = any (`elem` s)
prop_checkQuotesInLiterals1 = verifyTree checkQuotesInLiterals "param='--foo=\"bar\"'; app $param" prop_checkQuotesInLiterals1 = verifyTree checkQuotesInLiterals "param='--foo=\"bar\"'; app $param"