File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 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
18961896prop_checkSpuriousExec9 = verify checkSpuriousExec " for file in rc.d/*; do exec \" $file\" ; done"
18971897prop_checkSpuriousExec10 = verifyNot checkSpuriousExec " exec file; r=$?; printf >&2 'failed\n '; return $r"
18981898prop_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
19001902 where
19011903 doLists (T_Script _ _ cmds) = doList cmds False
19021904 doLists (T_BraceGroup _ cmds) = doList cmds False
Original file line number Diff line number Diff line change @@ -89,6 +89,8 @@ data Parameters = Parameters {
8989 hasSetE :: Bool ,
9090 -- Whether this script has 'set -o pipefail' anywhere.
9191 hasPipefail :: Bool ,
92+ -- Whether this script has 'shopt -s execfail' anywhere.
93+ hasExecfail :: Bool ,
9294 -- A linear (bad) analysis of data flow
9395 variableFlow :: [StackData ],
9496 -- A map from Id to Token
@@ -226,6 +228,10 @@ makeParameters spec = params
226228 BusyboxSh -> isOptionSet " pipefail" root
227229 Sh -> True
228230 Ksh -> isOptionSet " pipefail" root,
231+ hasExecfail =
232+ case shellType params of
233+ Bash -> isOptionSet " execfail" root
234+ _ -> False ,
229235 shellTypeSpecified = isJust (asShellType spec) || isJust (asFallbackShell spec),
230236 idMap = getTokenMap root,
231237 parentMap = getParentTree root,
You can’t perform that action at this time.
0 commit comments