From 63a259e5bed7c0f7f5287633e60f41605baa3e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Adri=C3=A1n=20Ontivero?= Date: Mon, 21 Jan 2019 19:49:14 +0100 Subject: [PATCH] Check type flags under dash and POSIX sh (fixes #1471) There are no flags for the type builtin defined under POSIX sh, nor does dash define any. Bash, however, allows [-aftpP]. We check this now under POSIX and dash. --- src/ShellCheck/Checks/ShellSupport.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ShellCheck/Checks/ShellSupport.hs b/src/ShellCheck/Checks/ShellSupport.hs index 1ea1681..8f55b3c 100644 --- a/src/ShellCheck/Checks/ShellSupport.hs +++ b/src/ShellCheck/Checks/ShellSupport.hs @@ -150,6 +150,8 @@ prop_checkBashisms67 = verify checkBashisms "#!/bin/sh\ncd -P -e ." prop_checkBashisms68 = verify checkBashisms "#!/bin/sh\numask -p" prop_checkBashisms69 = verifyNot checkBashisms "#!/bin/sh\numask -S" prop_checkBashisms70 = verify checkBashisms "#!/bin/sh\ntrap -l" +prop_checkBashisms71 = verify checkBashisms "#!/bin/sh\ntype -a ls" +prop_checkBashisms72 = verifyNot checkBashisms "#!/bin/sh\ntype ls" checkBashisms = ForShell [Sh, Dash] $ \t -> do params <- ask kludge params t @@ -302,6 +304,7 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do ("read", Just $ if isDash then ["r", "p"] else ["r"]), ("readonly", Just ["p"]), ("trap", Just []), + ("type", Just []), ("ulimit", if isDash then Nothing else Just ["f"]), ("umask", Just ["S"]) ]