Skip to content

fix(uv-platform): adjust windows ostype to match sys-info-rs, fix windows version#18383

Merged
zanieb merged 1 commit intoastral-sh:mainfrom
samypr100:adjust-host-info-windows
Mar 9, 2026
Merged

fix(uv-platform): adjust windows ostype to match sys-info-rs, fix windows version#18383
zanieb merged 1 commit intoastral-sh:mainfrom
samypr100:adjust-host-info-windows

Conversation

@samypr100
Copy link
Collaborator

@samypr100 samypr100 commented Mar 9, 2026

Summary

In #18324, sys-info-rs was dropped in favor of a more native reimplementation to provide OsType and OsRelease.

This PR adjusts two areas for windows to match closely previous behavior:

  1. OsType should be Windows rather than Windows_NT Drop the sys-info dependency #18324 (comment) as seen in https://github.com/FillZpp/sys-info-rs/blob/60ecf1470a5b7c90242f429934a3bacb6023ec4d/c/windows.c#L12. This also matches the output of platform.system() in CPython.
  2. OsRelease previously used GetVersionEx in sys-info-rs. Looking closely, this was used primarily in crates/uv-python/src/interpreter.rs and not in linehaul as linehaul uses platform.release(). The problem with GetVersionEx is that it returns often the wrong version due to legacy reasons (e.g. may be stuck returning 6.2.9200). The current implementation only returns the build number from the registry which is prone to problems across windows older variants. The implementation should use RtlGetVersion system call which returns the current major, minor, build in the same way as reported by sys.getwindowsversion() in CPython. In order to strike balance, this switches the implementation to use four octects {major}.{minor}.{build}.{revision} as recent windows versioning relies on major, build and revision where as older versions rely on major, minor and service pack. A windows-version crate by the same author as windows-rs was added as it includes the correct system calls for the windows versions.

Test Plan

Tested manually on both Windows desktop (10, 11) and Windows Server (2016).

@samypr100 samypr100 force-pushed the adjust-host-info-windows branch from 3ca8f7b to 5a5c9d5 Compare March 9, 2026 02:28
@samypr100 samypr100 added the windows Specific to the Windows platform label Mar 9, 2026
@samypr100 samypr100 force-pushed the adjust-host-info-windows branch from 5361207 to 95393e8 Compare March 9, 2026 02:41
@samypr100 samypr100 marked this pull request as ready for review March 9, 2026 02:44
Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!

@zanieb zanieb merged commit 9889525 into astral-sh:main Mar 9, 2026
79 of 81 checks passed
@samypr100 samypr100 deleted the adjust-host-info-windows branch March 9, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

windows Specific to the Windows platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants