Merge pull request #1430 from contivero/posix-sh-jobs-flags

Check jobs flags in dash/POSIX sh (fixes #1429)
This commit is contained in:
Vidar Holen 2018-12-28 15:53:17 -08:00 committed by GitHub
commit ef811995fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -138,6 +138,10 @@ prop_checkBashisms55= verify checkBashisms "#!/bin/sh\necho ${@%foo}"
prop_checkBashisms56= verifyNot checkBashisms "#!/bin/sh\necho ${##}"
prop_checkBashisms57= verifyNot checkBashisms "#!/bin/dash\nulimit -c 0"
prop_checkBashisms58= verify checkBashisms "#!/bin/sh\nulimit -c 0"
prop_checkBashisms59 = verify checkBashisms "#!/bin/sh\njobs -s"
prop_checkBashisms60 = verifyNot checkBashisms "#!/bin/sh\njobs -p"
prop_checkBashisms61 = verifyNot checkBashisms "#!/bin/sh\njobs -lp"
checkBashisms = ForShell [Sh, Dash] $ \t -> do
params <- ask
kludge params t
@ -283,6 +287,7 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do
allowedFlags = Map.fromList [
("exec", []),
("export", ["-p"]),
("jobs", ["l", "p"]),
("printf", []),
("read", if isDash then ["r", "p"] else ["r"]),
("ulimit", if isDash then ["H", "S", "t", "f", "d", "s", "c", "m", "l", "p", "n"] else ["f"])