From 2a58fffd832be4e75f98d647a68054049807240d Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Tue, 22 Sep 2026 06:35:34 +0900 Subject: [PATCH 1/2] Pick the WinIO test option in the cabal file, not in configure configure.ac probed for __IO_MANAGER_WINIO__ >= 2 and, when it found it, appended a test-suite stanza to network.buildinfo. Neither half worked. The probe sat behind `case "$host_os" in mingw*)`, but cabal runs configure under an MSYS shell on Windows, where config.guess resolves the host to *-pc-msys. The case never matched, so even on Windows config.log said checking whether to use native Windows I/O manager RTS option... no, not Windows and under plain cabal the option was never added: the test suite has run under MIO, in CI as much as locally. Where the host does resolve to mingw32, as with Stack (#633), the probe runs, compiling with the ghc on PATH rather than the compiler cabal was given. Once the probe succeeds, the second half shows. A .buildinfo carries a HookedBuildInfo, which Cabal accepts for the library and for named executables but not for a test-suite, so once the probe started succeeding the Windows build failed with network.buildinfo:3:1: invalid subsection "test-suite" Drop the machinery and say it in the cabal file, where the test-suite can be addressed directly. The compiler versions are spelled out rather than probed: the overlapped I/O exception fix landed on the 9.12 and 9.14 branches in April 2026, after 9.12.4 and 9.14.1 had been released. The lower bounds are exclusive so that release candidates and snapshots of those branches are covered as well. --with-compiler is still accepted, unused, so that cabal passing it does not draw an unrecognized-option warning. Verified on Windows 11 with 9.12.4.20260713: the option now reaches the link line, is embedded in the test binary, and the suite passes five runs out of five with WinIO as the default. Co-Authored-By: Claude Opus 5 (1M context) --- configure.ac | 39 +++------------------------------------ network.cabal | 9 +++++++++ 2 files changed, 12 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index 2e1f4246..4c7c9aa1 100644 --- a/configure.ac +++ b/configure.ac @@ -70,6 +70,9 @@ AC_ARG_WITH([cc], [CC=$withval]) AC_PROG_CC() +dnl cabal passes --with-compiler, so keep accepting it even though nothing +dnl here uses $HC any more; otherwise autoconf warns about an unrecognized +dnl option on every configure run. AC_ARG_WITH([compiler], [Haskell compiler], [HC=$withval]) @@ -105,40 +108,4 @@ dnl This is a necessary hack AC_MSG_NOTICE([creating ./network.buildinfo]) echo "install-includes: HsNetworkConfig.h" > network.buildinfo -WINIO_GHC_OPTIONS= -AC_MSG_CHECKING([whether to use native Windows I/O manager RTS option]) -case "$host_os" in -mingw*) - cat > conftest_ghc_cpp.hs </dev/null 2>&1; then - AC_MSG_RESULT([yes]) - WINIO_GHC_OPTIONS="-with-rtsopts=--io-manager=native" - else - AC_MSG_RESULT([no, $HC does not define __IO_MANAGER_WINIO__ >= 2]) - fi - rm -f conftest_ghc_cpp.hi conftest_ghc_cpp.hs conftest_ghc_cpp.o - ;; -*) - AC_MSG_RESULT([no, not Windows]) - ;; -esac - -dnl This is an overlay for the existing test-suite in network.cabal. Cabal -dnl conditionals cannot read values produced by configure, so the probe result -dnl has to be expressed as generated build info. -AS_IF([test -n "$WINIO_GHC_OPTIONS"], - [cat >> network.buildinfo <= 2. That landed on the 9.12 and + -- 9.14 branches in April 2026, after 9.12.4 and 9.14.1 had been released. + -- The lower bounds are exclusive so that release candidates and snapshots + -- of those branches, such as 9.12.4.20260713, are covered as well. + if os(windows) && (impl(ghc > 9.12.4 && < 9.13) || impl(ghc > 9.14.1)) + ghc-options: -with-rtsopts=--io-manager=native + build-depends: base, bytestring, From 4b9cb9c2414e6894096b11ac5e54be8a22b7a624 Mon Sep 17 00:00:00 2001 From: Kazu Yamamoto Date: Fri, 13 Nov 2026 10:31:14 +0900 Subject: [PATCH 2/2] Link the test suite with -rtsopts under WinIO So that +RTS --io-manager=posix can bring MIO back at run time. Co-Authored-By: Claude Opus 5.5 --- network.cabal | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/network.cabal b/network.cabal index 47a1cda6..3d736ba7 100644 --- a/network.cabal +++ b/network.cabal @@ -202,8 +202,9 @@ test-suite spec -- 9.14 branches in April 2026, after 9.12.4 and 9.14.1 had been released. -- The lower bounds are exclusive so that release candidates and snapshots -- of those branches, such as 9.12.4.20260713, are covered as well. + -- -rtsopts lets "+RTS --io-manager=posix" bring MIO back at run time. if os(windows) && (impl(ghc > 9.12.4 && < 9.13) || impl(ghc > 9.14.1)) - ghc-options: -with-rtsopts=--io-manager=native + ghc-options: -rtsopts -with-rtsopts=--io-manager=native build-depends: base,