From f3f167339f68d8365065fd74453333255c5dff3a Mon Sep 17 00:00:00 2001
From: Grayson Wolf <grayson.wolf@canonical.com>
Date: Tue, 11 Aug 2026 16:10:33 -0400
Subject: [PATCH] make UnixFilterError test robust against different coreutils
 implementations

On hosts with rust-coreutils/uutils, "head -#" returns a different error
message than on GNU coreutils, causing the test to fail to find "option"
and fail.

Fix by checking both a uutils substring and a gnu substring and passing
on either.
Origin: upstream, https://github.com/jaspervdj/hakyll/commit/6eade5594c189a21295b8432be04ba7fc14bcbd1
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/haskell-hakyll/+bug/2165939
---
 tests/Hakyll/Core/UnixFilter/Tests.hs |  5 ++++-
 tests/TestSuite/Util.hs               | 10 ++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/Hakyll/Core/UnixFilter/Tests.hs b/tests/Hakyll/Core/UnixFilter/Tests.hs
index ec2680cf..072b61b2 100644
--- a/tests/Hakyll/Core/UnixFilter/Tests.hs
+++ b/tests/Hakyll/Core/UnixFilter/Tests.hs
@@ -68,7 +68,10 @@ unixFilterError :: H.Assertion
 unixFilterError = do
     store    <- newTestStore
     provider <- newTestProvider store
-    testCompilerError store provider testMarkdown compiler "option"
+    testCompilerErrorMany store provider testMarkdown compiler [
+      "option", -- gnu coreutils
+      "unexpected argument" -- uutils
+      ]
     cleanTestEnv
   where
     compiler = getResourceString >>= withItemBody (unixFilter "head" ["-#"])
diff --git a/tests/TestSuite/Util.hs b/tests/TestSuite/Util.hs
index 1d5fc3f2..1b07a541 100644
--- a/tests/TestSuite/Util.hs
+++ b/tests/TestSuite/Util.hs
@@ -7,6 +7,7 @@ module TestSuite.Util
     , testCompiler
     , testCompilerDone
     , testCompilerError
+    , testCompilerErrorMany
     , testConfiguration
     , cleanTestEnv
     , renderParagraphs
@@ -98,6 +99,15 @@ testCompilerError store provider underlying compiler expectedMessage = do
            "Expecting '" ++ expectedMessage ++ "' error"
         _               -> assertFailure "Expecting CompilerError"
 
+testCompilerErrorMany :: Store -> Provider -> Identifier -> Compiler a -> [String] -> IO ()
+testCompilerErrorMany store provider underlying compiler expectedMessages = do
+    result   <- testCompiler store provider underlying compiler
+    case result of
+        CompilerError e ->
+            any (\err -> any (`isInfixOf` err) expectedMessages) (compilerErrorMessages e) @?
+           "Expecting one of " ++ show expectedMessages ++ " in error"
+        _               -> assertFailure "Expecting CompilerError"
+
 --------------------------------------------------------------------------------
 testConfiguration :: Configuration
 testConfiguration = defaultConfiguration

