-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Conversation
First contribution, be gentle :)
Sadly #1813 is sort of a collection of curve-balls:
GetWslVersionwas (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 (→
GetWslVersionwith uname-only check should be fine) - valid mountpoints (sadly
GetSystemDriveMountPathhas 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)
- wsl (→
- that check must be used consistently at the correct position in OpenDefaultBrowser
- the presence of
wslviewdoes 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().
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.
Uh oh!
There was an error while loading. Please reload this page.
Removes inspection of
/proc/versionstrings for detecting WSL1 or WSL2./proc/versionis 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 #1813Inspects
/proc/sys/fs/binfmt_misc/WSLInteropand/proc/sys/fs/binfmt_misc/WSLInterop-Latefor respectively detecting WSL1 or WSL2. This is consistent across distros and the files aren't inherited into containers.Removes inspection of
WSL_INTEROPenv var for detecting WSL2. Deemed not necessary anymore.