Merge pull request #3305 from e-kwsm/pipefail

feat(SC3040): support `set -o pipefail` as specified by POSIX.1-2024
This commit is contained in:
Vidar Holen
2025-09-24 19:16:19 -07:00
committed by GitHub
2 changed files with 5 additions and 5 deletions

View File

@@ -224,9 +224,9 @@ makeParameters spec = params
hasPipefail = hasPipefail =
case shellType params of case shellType params of
Bash -> isOptionSet "pipefail" root Bash -> isOptionSet "pipefail" root
Dash -> True Dash -> isOptionSet "pipefail" root
BusyboxSh -> isOptionSet "pipefail" root BusyboxSh -> isOptionSet "pipefail" root
Sh -> True Sh -> isOptionSet "pipefail" root
Ksh -> isOptionSet "pipefail" root, Ksh -> isOptionSet "pipefail" root,
hasExecfail = hasExecfail =
case shellType params of case shellType params of

View File

@@ -175,7 +175,7 @@ prop_checkBashisms80 = verifyNot checkBashisms "#!/bin/sh\nhash -r"
prop_checkBashisms81 = verifyNot checkBashisms "#!/bin/dash\nhash -v" prop_checkBashisms81 = verifyNot checkBashisms "#!/bin/dash\nhash -v"
prop_checkBashisms82 = verifyNot checkBashisms "#!/bin/sh\nset -v +o allexport -o errexit -C" prop_checkBashisms82 = verifyNot checkBashisms "#!/bin/sh\nset -v +o allexport -o errexit -C"
prop_checkBashisms83 = verifyNot checkBashisms "#!/bin/sh\nset --" prop_checkBashisms83 = verifyNot checkBashisms "#!/bin/sh\nset --"
prop_checkBashisms84 = verify checkBashisms "#!/bin/sh\nset -o pipefail" prop_checkBashisms84 = verifyNot checkBashisms "#!/bin/sh\nset -o pipefail"
prop_checkBashisms85 = verify checkBashisms "#!/bin/sh\nset -B" prop_checkBashisms85 = verify checkBashisms "#!/bin/sh\nset -B"
prop_checkBashisms86 = verifyNot checkBashisms "#!/bin/dash\nset -o emacs" prop_checkBashisms86 = verifyNot checkBashisms "#!/bin/dash\nset -o emacs"
prop_checkBashisms87 = verify checkBashisms "#!/bin/sh\nset -o emacs" prop_checkBashisms87 = verify checkBashisms "#!/bin/sh\nset -o emacs"
@@ -383,8 +383,8 @@ checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
beginsWithDoubleDash = (`matches` mkRegex "^--.+$") beginsWithDoubleDash = (`matches` mkRegex "^--.+$")
longOptions = Set.fromList longOptions = Set.fromList
[ "allexport", "errexit", "ignoreeof", "monitor", "noclobber" [ "allexport", "errexit", "ignoreeof", "monitor", "noclobber"
, "noexec", "noglob", "nolog", "notify" , "nounset", "verbose" , "noexec", "noglob", "nolog", "notify" , "nounset", "pipefail"
, "vi", "xtrace" ] , "verbose", "vi", "xtrace" ]
bashism t@(T_SimpleCommand id _ (cmd:rest)) = bashism t@(T_SimpleCommand id _ (cmd:rest)) =
let name = fromMaybe "" $ getCommandName t let name = fromMaybe "" $ getCommandName t