Repository navigation
fix(wsl): decode UTF-16 version output - #12
Merged
Merged
Conversation
`wsl --version` writes UTF-16LE when stdout is a pipe. Reading those bytes as UTF-8 splits 3.0.1.0 with NUL gaps, so first launch reports WSL as missing. Accept 3.0.1.0 as >= 2.9.3. Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Keep the first-launch WSL gate from main and decode `wsl --version` as UTF-16LE so 3.0.1.0 still passes >= 2.9.3. Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
Record the UTF-16 WSL version fix under 0.1.2. Co-authored-by: 绿岸公式 <chinesejar@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First launch treated an installed WSL 3.0.1.0 as missing.
wsl.exe --versionwrites UTF-16LE when stdout is a pipe. The setup probe read those bytes withString::from_utf8_lossy, so ASCII came through with NUL gaps (W\0S\0L\0 \03\0.\00\0.\01\0.\00) and版本showed up as Latin-1Hr,g. The version scanner splits on anything that is not a digit or., so3.0.1.0never formed a token and the check failed.WSL version:/WSL 版本:), not the kernel, WSLg, or Windows lines. A spaced misread (W S L Hr,g: 3 . 0 . 1 . 0) still collapses back to3.0.1.0.3.0.1.0satisfies>= 2.9.3(fourth component is the Windows revision; a missing component counts as 0). Older than 2.9.3 stops setup and asks forwsl --update.Test plan
cargo test -- wslc::sdk_version(Linux): UTF-16LE Chinesewsl --versionbytes, UTF-16LE BOM on stderr, NUL-separated misread, spacedHr,gregression, odd-length NUL-strip fallback, kernel/WSLg lines ignored,2.9.3boundary and3.0.1.0 >= 2.9.3Host version: 3.0.1.0instead of “could not read version”