diff --git a/138080bd.patch b/138080bd.patch new file mode 100644 index 0000000..7e1f9ba --- /dev/null +++ b/138080bd.patch @@ -0,0 +1,35 @@ +From 138080bdc7442458f45bd2726d9e8cb4b68cf24f Mon Sep 17 00:00:00 2001 +From: Vidar Holen +Date: Sun, 16 Dec 2018 14:42:19 -0800 +Subject: [PATCH] Fix infinite loop on annotations for SC2188 (fixes #1413) + +--- + src/ShellCheck/Analytics.hs | 2 +- + src/ShellCheck/Checker.hs | 2 ++ + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/ShellCheck/Analytics.hs b/src/ShellCheck/Analytics.hs +index 7754ee64..a164de13 100644 +--- a/src/ShellCheck/Analytics.hs ++++ b/src/ShellCheck/Analytics.hs +@@ -2692,7 +2692,7 @@ checkRedirectedNowhere params token = + case drop 1 $ getPath (parentMap params) t of + T_DollarExpansion _ [_] : _ -> True + T_Backticked _ [_] : _ -> True +- T_Annotation _ _ u : _ -> isInExpansion u ++ t@T_Annotation {} : _ -> isInExpansion t + _ -> False + getDanglingRedirect token = + case token of +diff --git a/src/ShellCheck/Checker.hs b/src/ShellCheck/Checker.hs +index 7ac9c913..10074e38 100644 +--- a/src/ShellCheck/Checker.hs ++++ b/src/ShellCheck/Checker.hs +@@ -231,5 +231,7 @@ prop_filewideAnnotation8 = null $ + prop_sourcePartOfOriginalScript = -- #1181: -x disabled posix warning for 'source' + 2039 `elem` checkWithIncludes [("./saywhat.sh", "echo foo")] "#!/bin/sh\nsource ./saywhat.sh" + ++prop_spinBug1413 = null $ check "fun() {\n# shellcheck disable=SC2188\n> /dev/null\n}\n" ++ + return [] + runTests = $quickCheckAll diff --git a/ShellCheck.spec b/ShellCheck.spec index 2f57375..0165718 100644 --- a/ShellCheck.spec +++ b/ShellCheck.spec @@ -17,6 +17,9 @@ Url: https://www.shellcheck.net/ Source0: https://hackage.haskell.org/package/%{pkgver}/%{pkgver}.tar.gz # End cabal-rpm sources +# https://bugzilla.redhat.com/show_bug.cgi?id=1707331 +Patch0: https://github.com/koalaman/shellcheck/commit/138080bd.patch + # Begin cabal-rpm deps: BuildRequires: ghc-Cabal-devel BuildRequires: ghc-rpm-macros @@ -68,7 +71,7 @@ This package provides the Haskell %{name} library development files. %prep # Begin cabal-rpm setup: -%setup -q +%autosetup -p1 # End cabal-rpm setup