Skip to content

Groundwork for the native Windows (mingw-w64) port - #6569

Open
fingolfin wants to merge 4 commits into
masterfrom
mh/windows-groundwork
Open

Groundwork for the native Windows (mingw-w64) port#6569
fingolfin wants to merge 4 commits into
masterfrom
mh/windows-groundwork

Conversation

@fingolfin

Copy link
Copy Markdown
Member

Groundwork for the native Windows (mingw-w64) port, split off #6557: the four commits that change nothing on current platforms.

  • SYS_IS_WINDOWS, from _WIN32; disjoint from SYS_IS_CYGWIN32
  • guards for POSIX-only kernel code (termios, uname, sigaction, lstat, ttyname, mkdtemp, realpath, readlink, getrusage, sleep, environ, mkdir), with the matching configure checks; on Windows, CPU times come from GetProcessTimes, TmpDirectory from an mkdtemp built on _mktemp and mkdir, the uname record from RtlGetVersion
  • SYS_IS_CYGWIN32 guards that any Windows needs (O_BINARY, CRLF stripping, temp dir fallback, ~/_gap, GMP bag zeroing) widened to SYS_IS_WINDOWS
  • two small alignments with POSIX: SyFseek rejects negative positions, the ExecuteProcess stub validates its arguments

Every guard is a no-op where GAP builds today. The rest of the port sits on top in #6557, whose CI job exercises the Windows side.

🤖 Generated with Claude Code

This has IMHO decent quality and is not sloppy, so I have no qualms asking for reviews :-)

@fingolfin fingolfin added os: windows Issues and PRs that are (at least partially) specific to Windows topic: kernel release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Sep 8, 2026
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.04%. Comparing base (3f58fc7) to head (a3ebb71).

Files with missing lines Patch % Lines
lib/system.g 66.66% 1 Missing ⚠️
src/sysfiles.c 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6569      +/-   ##
==========================================
+ Coverage   79.02%   79.04%   +0.02%     
==========================================
  Files         683      683              
  Lines      295190   295195       +5     
  Branches     8638     8663      +25     
==========================================
+ Hits       233264   233342      +78     
+ Misses      60107    60035      -72     
+ Partials     1819     1818       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread src/common.h Outdated
Comment thread src/gaptime.c
Comment thread src/iostream.c Outdated
Comment thread src/streams.c Outdated
Comment thread src/sysroots.c
fingolfin and others added 4 commits September 10, 2026 16:05
SYS_IS_MINGW marks a native Windows build: mingw-w64 predefines
_WIN32, Cygwin GCC does not, as Cygwin is a POSIX system to GAP. So
SYS_IS_MINGW and SYS_IS_CYGWIN32 are mutually exclusive, and
SYS_IS_WINDOWS now covers both, for the places which care about the
operating system rather than the C library. Groundwork for the MinGW
port (#4157).

ARCH_IS_WINDOWS() also reports true for a "mingw" architecture.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Make the kernel compile with mingw-w64 (#4157, partly after #6077):
termios, uname, sigaction, lstat, ttyname, mkdtemp, realpath,
readlink, getrusage, sleep, environ, mkdir. Without termios the line
editor falls back to syFgetsNoEdit. On Windows, SyTime and RUNTIMES
use GetProcessTimes, TmpDirectory a mkdtemp built on _mktemp and
mkdir, SyGetOsRelease RtlGetVersion. The fork and pty based
subprocess code is compiled out, leaving the stubs of
GAP_DISABLE_SUBPROCESS_CODE builds. charreadhook_rl is only defined
with select, its sole user.

New configure checks: sys/utsname.h, realpath, readlink, mkdtemp,
lstat, ttyname. No-ops on current platforms.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Some SYS_IS_CYGWIN32 guards cover behavior any Windows needs, not
Cygwin quirks: O_BINARY, CRLF stripping, the C:/WINDOWS/Temp
fallback, backslash conversion in root paths, ~/_gap, and the GMP bag
zeroing for #3434. Widen them to SYS_IS_WINDOWS. Genuine Cygwin
quirks stay Cygwin-only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Two testinstall diffs:

- SyFseek: reject negative positions; Windows' lseek accepts them
- the ExecuteProcess stub validates its arguments like the real
  implementation, so the documented errors come first

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@fingolfin
fingolfin force-pushed the mh/windows-groundwork branch from 726099d to a3ebb71 Compare September 10, 2026 16:27
@fingolfin

Copy link
Copy Markdown
Member Author

@ChrisJefferson @lgoettgens thank you for your feedback. I think we addressed all your points so far now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

os: windows Issues and PRs that are (at least partially) specific to Windows release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes topic: kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants