From 0dd5c67bdf0fe5f0d03e4d2f6fc04c3796408ccd Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Thu, 21 Oct 2021 20:58:14 -0700 Subject: [PATCH] Warn about [^..] in Dash (fixes #2361) --- src/ShellCheck/Checks/ShellSupport.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ShellCheck/Checks/ShellSupport.hs b/src/ShellCheck/Checks/ShellSupport.hs index 1d373e5..092c2bf 100644 --- a/src/ShellCheck/Checks/ShellSupport.hs +++ b/src/ShellCheck/Checks/ShellSupport.hs @@ -180,7 +180,7 @@ prop_checkBashisms95 = verify checkBashisms "#!/bin/sh\necho $_" prop_checkBashisms96 = verifyNot checkBashisms "#!/bin/dash\necho $_" prop_checkBashisms97 = verify checkBashisms "#!/bin/sh\necho ${var,}" prop_checkBashisms98 = verify checkBashisms "#!/bin/sh\necho ${var^^}" -prop_checkBashisms99 = verifyNot checkBashisms "#!/bin/dash\necho [^f]oo" +prop_checkBashisms99 = verify checkBashisms "#!/bin/dash\necho [^f]oo" checkBashisms = ForShell [Sh, Dash] $ \t -> do params <- ask kludge params t @@ -235,7 +235,7 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do where file = onlyLiteralString word isNetworked = any (`isPrefixOf` file) ["/dev/tcp", "/dev/udp"] - bashism (T_Glob id str) | not isDash && "[^" `isInfixOf` str = + bashism (T_Glob id str) | "[^" `isInfixOf` str = warnMsg id 3026 "^ in place of ! in glob bracket expressions is" bashism t@(TA_Variable id str _) | isBashVariable str =