File tree 2 files changed +9
-1
lines changed
2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1896,7 +1896,9 @@ prop_checkSpuriousExec8 = verifyNot checkSpuriousExec "exec {origout}>&1- >tmp.l
1896
1896
prop_checkSpuriousExec9 = verify checkSpuriousExec " for file in rc.d/*; do exec \" $file\" ; done"
1897
1897
prop_checkSpuriousExec10 = verifyNot checkSpuriousExec " exec file; r=$?; printf >&2 'failed\n '; return $r"
1898
1898
prop_checkSpuriousExec11 = verifyNot checkSpuriousExec " exec file; :"
1899
- checkSpuriousExec _ = doLists
1899
+ prop_checkSpuriousExec12 = verifyNot checkSpuriousExec " #!/bin/bash\n shopt -s execfail; exec foo; exec bar; echo 'Error'; exit 1;"
1900
+ prop_checkSpuriousExec13 = verify checkSpuriousExec " #!/bin/dash\n shopt -s execfail; exec foo; exec bar; echo 'Error'; exit 1;"
1901
+ checkSpuriousExec params t = when (not $ hasExecfail params) $ doLists t
1900
1902
where
1901
1903
doLists (T_Script _ _ cmds) = doList cmds False
1902
1904
doLists (T_BraceGroup _ cmds) = doList cmds False
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ data Parameters = Parameters {
89
89
hasSetE :: Bool ,
90
90
-- Whether this script has 'set -o pipefail' anywhere.
91
91
hasPipefail :: Bool ,
92
+ -- Whether this script has 'shopt -s execfail' anywhere.
93
+ hasExecfail :: Bool ,
92
94
-- A linear (bad) analysis of data flow
93
95
variableFlow :: [StackData ],
94
96
-- A map from Id to Token
@@ -226,6 +228,10 @@ makeParameters spec = params
226
228
BusyboxSh -> isOptionSet " pipefail" root
227
229
Sh -> True
228
230
Ksh -> isOptionSet " pipefail" root,
231
+ hasExecfail =
232
+ case shellType params of
233
+ Bash -> isOptionSet " execfail" root
234
+ _ -> False ,
229
235
shellTypeSpecified = isJust (asShellType spec) || isJust (asFallbackShell spec),
230
236
idMap = getTokenMap root,
231
237
parentMap = getParentTree root,
You can’t perform that action at this time.
0 commit comments