@@ -768,7 +768,9 @@ checkFindExec _ cmd@(T_SimpleCommand _ _ t@(h:r)) | cmd `isCommand` "find" = do
768768 when v (mapM_ warnFor $ fromWord w)
769769 case getLiteralString w of
770770 Just " -exec" -> broken r True
771- Just " -execdir" -> broken r True
771+ Just " -execdir" -> broken r True -- n.b. -execdir ;/+ is not defined in POSIX
772+ Just " -ok" -> broken r True -- n.b. -ok + is not defined in POSIX
773+ Just " -okdir" -> broken r True -- n.b. -okdir ;/+ is not defined in POSIX
772774 Just " +" -> broken r False
773775 Just " ;" -> broken r False
774776 _ -> broken r v
@@ -1142,7 +1144,7 @@ checkSingleQuotedVariables params t@(T_SingleQuoted id s) =
11421144
11431145 getFindCommand (T_SimpleCommand _ _ words ) =
11441146 let list = map getLiteralString words
1145- cmd = dropWhile (\ x -> x /= Just " -exec" && x /= Just " -execdir " ) list
1147+ cmd = dropWhile (\ x -> x `notElem` map Just [ " -exec" , " -execdir " , " -ok " , " -okdir " ] ) list
11461148 in
11471149 case cmd of
11481150 (flag: cmd: rest) -> fromMaybe " find" cmd
@@ -2336,7 +2338,7 @@ prop_checkFunctionsUsedExternally2 =
23362338prop_checkFunctionsUsedExternally2b =
23372339 verifyNotTree checkFunctionsUsedExternally " alias f='a'; find . -type f"
23382340prop_checkFunctionsUsedExternally2c =
2339- verifyTree checkFunctionsUsedExternally " alias f='a'; find . -type f -exec f +"
2341+ verifyTree checkFunctionsUsedExternally " alias f='a'; find . -type f -exec f {} +"
23402342prop_checkFunctionsUsedExternally3 =
23412343 verifyNotTree checkFunctionsUsedExternally " f() { :; }; echo f"
23422344prop_checkFunctionsUsedExternally4 =
@@ -2387,7 +2389,7 @@ checkFunctionsUsedExternally params t =
23872389 _ -> []
23882390 where
23892391 firstNonFlag = take 1 $ dropFlags argAndString
2390- findExecFlags = [" -exec" , " -execdir" , " -ok" ]
2392+ findExecFlags = [" -exec" , " -execdir" , " -ok" , " -okdir " ]
23912393 dropFlags = dropWhile (\ x -> " -" `isPrefixOf` fst x)
23922394
23932395 functionsAndAliases = Map. union (functions t) (aliases t)
0 commit comments