Check cd flags under dash & POSIX sh (fixes #1457)

This commit is contained in:
Cristian Adrián Ontivero 2019-01-14 08:18:17 +01:00
parent e0a4241baa
commit c3a56659f4
No known key found for this signature in database
GPG Key ID: 00B7629CAD43E113
1 changed files with 3 additions and 0 deletions

View File

@ -145,6 +145,8 @@ prop_checkBashisms62 = verify checkBashisms "#!/bin/sh\nexport -f foo"
prop_checkBashisms63 = verifyNot checkBashisms "#!/bin/sh\nexport -p"
prop_checkBashisms64 = verify checkBashisms "#!/bin/sh\nreadonly -a"
prop_checkBashisms65 = verifyNot checkBashisms "#!/bin/sh\nreadonly -p"
prop_checkBashisms66 = verifyNot checkBashisms "#!/bin/sh\ncd -P ."
prop_checkBashisms67 = verify checkBashisms "#!/bin/sh\ncd -P -e ."
checkBashisms = ForShell [Sh, Dash] $ \t -> do
params <- ask
kludge params t
@ -288,6 +290,7 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do
"typeset"
] ++ if not isDash then ["local"] else []
allowedFlags = Map.fromList [
("cd", ["L", "P"]),
("exec", []),
("export", ["p"]),
("jobs", ["l", "p"]),