T12971 is broken on Windows
This was originally tracked in #17943.
Currently T12971
fails inexplicably on Windows:
Wrong exit code for T12971()(expected 0 , actual 2 )
Stdout ( T12971 ):
[1 of 1] Compiling Main ( T12971.hs, T12971.o )
Linking T12971.exe ...
Stderr ( T12971 ):
ghc.exe: panic! (the 'impossible' happened)
(GHC version 8.11.0.20200320:
thread blocked indefinitely in an MVar operation
Please report this as a GHC bug: https://www.haskell.org/ghc/reportabug
ghc.exe: fd:5: hGetContents: invalid argument (invalid byte sequence)
make: *** [Makefile:670: T12971] Error 1
*** unexpected failure for T12971(normal)
The issue appears to be an encoding issue; I suspect the issue is the hGetContents
call in SysTools.Process.readCreateProcessWithExitCode'
in particular.
However, neither forcing use of the 65001 codepage nor forcing the encoding of the outh
handle in readCreateProcessWithExitCode'
seem to avoid the issue:
diff --git a/compiler/main/SysTools/Process.hs b/compiler/main/SysTools/Process.hs
index aa5d6617d3..a23d529132 100644
--- a/compiler/main/SysTools/Process.hs
+++ b/compiler/main/SysTools/Process.hs
@@ -55,7 +55,10 @@ readCreateProcessWithExitCode' proc = do
createProcess proc{ std_out = CreatePipe }
-- fork off a thread to start consuming the output
+ putStrLn "hello1"
+ hSetEncoding outh utf8
output <- hGetContents outh
+ putStrLn "hello2"
outMVar <- newEmptyMVar
_ <- forkIO $ evaluate (length output) >> putMVar outMVar ()
Even stranger, I am unable to reproduce the issue outside of the testsuite driver.
Stranger still, the test still fails even if I modify the test definition to remove any sign of non-7-bit characters from TMP
:
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 77a77c158d..07577cfb5e 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -666,8 +666,8 @@ T12955:
.PHONY: T12971
T12971:
- mkdir -p ä
- TMP=ä "$(TEST_HC)" $(TEST_HC_OPTS) --make T12971
+ mkdir -p a
+ TMP=a "$(TEST_HC)" -v3 -optc-fno-diagnostics-color $(TEST_HC_OPTS) --make T12971
.PHONY: T14452
T14452:
However, the failure does vanish if I remove the TMP=a
from the test's command-line entirely.
Given that this really isn't a critical issue, I'm going to mark this test as broken.