Skip to content

Fix is_wsl() on wsl2#7027

Merged
zanchey merged 2 commits into
fish-shell:masterfrom
cherichy:patch-1
May 25, 2020
Merged

Fix is_wsl() on wsl2#7027
zanchey merged 2 commits into
fish-shell:masterfrom
cherichy:patch-1

Conversation

@cherichy
Copy link
Copy Markdown
Contributor

On wsl2, /proc/version contains no "Microsoft" as wsl1 do.
Changing "Microsoft" to "microsoft" will make it work on both wsl1 and wsl2.

on wsl2 the /proc/version contains no Microsoft as wsl1 do.
@faho
Copy link
Copy Markdown
Member

faho commented May 21, 2020

  1. Are our workarounds still required on WSL2? Personally I'd love to just handle that as linux, basically anything we have to do specifically for it should be a bug there as I understand WSL's purpose. (also is WSL1 now dead or still a thing?)

  2. That's not the only place we do that check, see also

    and string match -riq 'Microsoft|WSL' </proc/version
    and
    if (std::strstr(info.release, "Microsoft") != nullptr) {
    .

@faho faho added this to the fish 3.2.0 milestone May 21, 2020
@cherichy
Copy link
Copy Markdown
Contributor Author

If we treat wsl2 as linux, "webbrowser.open(fileurl)" is called. But a url like "file:///home/xxx/" doesn't work under wsl2.

@ammgws
Copy link
Copy Markdown
Contributor

ammgws commented May 21, 2020

also is WSL1 now dead or still a thing?

WSL2 is not officially out yet as far as I know. And even if it was, people will still be on WSL1 for a while. At least I will, since updates are controlled by company IT and they're slow at rolling out new versions of windows

@zanchey
Copy link
Copy Markdown
Member

zanchey commented May 21, 2020

The "broken" versions referred to in the common.cpp check are still in support (until November 2020), and the WSL check is still needed to block .dll files from completion (a9b582d).

@faho
Copy link
Copy Markdown
Member

faho commented May 24, 2020

Okay, so if a check for lowercase "microsoft" works here as well, should we just change that everywhere?

Mind that the checks are typically case-sensitive.

@cherichy
Copy link
Copy Markdown
Contributor Author

The utsname.release on wsl1looks like "4.4.0-18362-Microsoft" (windows 1903 (18362)).
But on wsl2, it looks like ”4.19.84-microsoft-standard" (with windows 2004 (19041)).
Discussions can be found here. How to tell in Linux under WSL if using WSL1 vs WSL2 ?
I am sorry that my patch using lowercase only works for wsl2. I will change it to check both cases.

@cherichy
Copy link
Copy Markdown
Contributor Author

@faho I have checked the files common.cpp and help.fish. They don't need to change.
The problem is fish_config falis to start on wsl2. And the workarounds can be applied only in this file.

@zanchey
Copy link
Copy Markdown
Member

zanchey commented May 25, 2020

Yes, sounds good; the common.cpp check is another issue which doesn't need to block the merging of this patch.

@zanchey zanchey self-assigned this May 25, 2020
@zanchey zanchey merged commit f32777a into fish-shell:master May 25, 2020
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants