Skip to content

Pick the WinIO test option in the cabal file, not in configure - #628

Open
kazu-yamamoto wants to merge 1 commit into
haskell:masterfrom
kazu-yamamoto:configure-winio
Open

kazu-yamamoto wants to merge 1 commit into
haskell:masterfrom
kazu-yamamoto:configure-winio

Conversation

@kazu-yamamoto

Copy link
Copy Markdown
Collaborator

The -with-rtsopts=--io-manager=native that #613 added for the test suite has
never been applied, on any platform. There are two separate bugs, one behind the
other.

1. The probe never ran

configure.ac guards it with:

case "$host_os" in
mingw*)

but cabal runs configure under an MSYS shell on Windows, where uname -s
reports MSYS_NT-10.0-26200 and config.guess resolves the host to
x86_64-pc-msys. From a config.log of a Windows build on master:

ac_cv_host=x86_64-pc-msys
host_os='msys'
configure:4454: checking whether to use native Windows I/O manager RTS option
configure:4477: result: no, not Windows

So the option was never added, and the test suite has always run under MIO,
in CI as much as locally
.

2. The mechanism cannot work either

Widening the host test just exposes the next problem. configure appends

test-suite spec
  ghc-options: -with-rtsopts=--io-manager=native

to network.buildinfo, but a .buildinfo carries a HookedBuildInfo, which
Cabal accepts for the library and for named executables — not for a test-suite.
With the probe succeeding, every Windows build fails:

Warning: network.buildinfo:3:1: invalid subsection "test-suite"
Error: [Cabal-6565] Failed parsing "network.buildinfo".

The fix

Drop the machinery and say it in the cabal file, where the test-suite can be
addressed directly:

    if os(windows) && (impl(ghc > 9.12.4 && < 9.13) || impl(ghc > 9.14.1))
        ghc-options: -with-rtsopts=--io-manager=native

The compiler versions are spelled out rather than probed. The overlapped I/O
exception fix — the one that bumps __IO_MANAGER_WINIO__ to 2 — landed on the
ghc-9.12 and ghc-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.

--with-compiler is still accepted, now unused, so that cabal passing it does
not draw an unrecognized-option warning.

Testing

  • macOS: the condition does not apply; 87 examples, 0 failures.
  • Windows 11 arm64, GHC 9.12.4.20260713 (the 9.12.5 release candidate):
    • -with-rtsopts=--io-manager=native now reaches the link line (cabal -v2)
      and the string is embedded in the built spec.exe;
    • the generated network.buildinfo is back to its single valid line;
    • 82 examples, 0 failures, five runs out of five, with WinIO as the default.

Trade-off

Spelled-out version bounds need maintaining: a later backport, to 9.10 say,
would have to be added by hand. The probe would have tracked that automatically,
but it had no way to deliver its answer to the test-suite, which is what broke.

Refs #602, #613.

🤖 Generated with Claude Code

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 the option was never added.  The test suite has therefore always run
under MIO, in CI as much as locally.

Fixing the host test only exposed the second half.  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 every 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) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant