Don't warn about quotes in variables for eval

This commit is contained in:
Vidar Holen 2014-01-16 19:41:09 -08:00
parent 1d2c7a8551
commit 4dca88aade
1 changed files with 4 additions and 1 deletions

View File

@ -1722,6 +1722,7 @@ prop_checkQuotesInLiterals1a= verifyFull checkQuotesInLiterals "param=\"--foo='l
prop_checkQuotesInLiterals2 = verifyNotFull checkQuotesInLiterals "param='--foo=\"bar\"'; app \"$param\""
prop_checkQuotesInLiterals3 =verifyNotFull checkQuotesInLiterals "param=('--foo='); app \"${param[@]}\""
prop_checkQuotesInLiterals4 = verifyNotFull checkQuotesInLiterals "param=\"don't bother with this one\"; app $param"
prop_checkQuotesInLiterals5 = verifyNotFull checkQuotesInLiterals "param=\"--foo='lolbar'\"; eval app $param"
checkQuotesInLiterals t =
doVariableFlowAnalysis readF writeF Map.empty t
where
@ -1743,7 +1744,9 @@ checkQuotesInLiterals t =
readF _ expr name = do
assignment <- getQuotes name
if isJust assignment && not (inUnquotableContext parents expr)
if isJust assignment
&& not (isParamTo parents "eval" expr)
&& not (inUnquotableContext parents expr)
then return [
(fromJust assignment,
Note WarningC 2089 "Word splitting will treat quotes as literals. Use an array."),