Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Reworking wsl detection logic to avoid false-positives in containers #2064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
rtrevi wants to merge 1 commit into git-ecosystem:main
base: main
Choose a base branch
Loading
from rtrevi:rtrevi/wsl-detection-binfmts

Conversation

@rtrevi
Copy link

@rtrevi rtrevi commented Oct 2, 2025
edited
Loading

  • Removes inspection of /proc/version strings for detecting WSL1 or WSL2. /proc/version is inherited by containers within WSL, causing gcm to wrongly identify these containers as WSL distros: Bug: GCM Misidentifies Docker Containers Running on WSL2 Due to /proc/version #1813

  • Inspects /proc/sys/fs/binfmt_misc/WSLInterop and /proc/sys/fs/binfmt_misc/WSLInterop-Late for respectively detecting WSL1 or WSL2. This is consistent across distros and the files aren't inherited into containers.

  • Removes inspection of WSL_INTEROP env var for detecting WSL2. Deemed not necessary anymore.

@rtrevi rtrevi requested a review from a team as a code owner October 2, 2025 20:13
Copy link
Author

rtrevi commented Oct 2, 2025

First contribution, be gentle :)

Copy link

becm commented Oct 3, 2025
edited
Loading

Sadly #1813 is sort of a collection of curve-balls:

  • GetWslVersion was (effectively) fine as-is (albeit I'd support dropping the confusing interop test there)
  • detection of "WSL-interop case for the Browser" (the relevant condition) should be a separate check
    • wsl (→ GetWslVersion with uname-only check should be fine)
    • valid mountpoints (sadly GetSystemDriveMountPath has a default fallack → retest required)
    • interop (insert binfmt check here ☺)
    • and only then use Powershell to check SessionId
    • allow falling back to IsDesktopSession (use browser within the WSL or container scope)
  • that check must be used consistently at the correct position in OpenDefaultBrowser
  • the presence of wslview does not help, as it relies on interop capabilities (and the project is now PPA only).

In the interop-capable case the Browser should to be started by raw

<wslmount>/Windows/System32/cmd.exe /c start <url>

(or an equivalent powershell command) on the host Windows system,
ideally encapsulated in something like WslUtils.openUrl().

Copy link
Author

rtrevi commented Oct 6, 2025

Sadly #1813 is sort of a collection of curve-balls:

A bit out of my depth there 😅
I'l lleave the PR open if anyone wants to piggy back off of it, but I'm not confident I could rework the module succesfully.

@rtrevi rtrevi marked this pull request as draft October 6, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /