You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: Errno classes come from the raw Win32 code; MRI maps it through rb_w32_map_errno first #980
On Windows a syscall.Errno carries the Win32 error code itself (ERROR_PATH_NOT_FOUND is 3), while errnoClasses / errnoNumbers are keyed by the numbers Go invented for the POSIX names. Every raiser that turns an error into an Errno class by looking its number up directly — sysFail (internal/vm/process.go) and the paths that go through errnoOfError — therefore reads a Win32 code as a POSIX number and picks an unrelated class, or none.
MRI maps every Win32 code first, through errmap and rb_w32_map_errno (win32/win32.c:145 and :282, v4.0.9): a code in the table gets its class, a code at or above WSABASEERR is kept, any other is EINVAL.
Seen
#978's Windows runner: a flush under a missing directory raised Errno::ENOTDIR (3 read as a POSIX number) where MRI raises Errno::ENOENT. #978 fixes the flush path only: internal/vm/errno_win32_windows.go ports the Win32 rows of errmap as mapHostErrno, and raiseFlushErr applies it.
Proposed
Apply mapHostErrno in errnoOfError itself (the !plan9 host file), so every raiser maps the code as MRI does, then:
port the WSA rows of errmap too, for the socket errors (WSAECONNRESET → ECONNRESET, …), which need the names ESHUTDOWN, ETOOMANYREFS, EPROCLIM, EUSERS, EREMOTE from the per-platform errno tables;
audit the Windows-only tests that currently expect a class derived from a raw Win32 code, as they assert the divergence.
Prior art: priorart "rb_w32_map_errno win32 errno mapping" at 2026-11-22 21:49 CET reported prior art; checked: priorart matched 106 entries on the word errno; read the top ones: #633 is darwin constant values, #635/#636 other Windows gaps, #685/#975 other errno work; the only one about mapping Win32 codes is #978 itself, which fixes the flush path and defers this
Activity