microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.26k stars 812 forks source link

bash $PATH includes native Windows path entries #1640

Closed markgross closed 7 years ago

markgross commented 7 years ago

I see that my Anaconda3 (a windows python distrobution) has executibles on the bash path. I expected only linux native programs to be accessible from the ubuntu bash env.

mgross@marks-x1:~$ which fetch_file.exe /mnt/c/Program Files/Anaconda3/Scripts/fetch_file.exe mgross@marks-x1:~$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Windows/System32:/mnt/c/Windows:/mnt/c/Windows/System32/wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0:/mnt/c/Program Files/Anaconda3:/mnt/c/Program Files/Anaconda3/Scripts:/mnt/c/Program Files/Anaconda3/Library/bin:/mnt/c/Users/mark9/AppData/Local/Microsoft/WindowsApp

I worry that the leakage of the Windows environment into the bash will result in unexpected behaviors from time to time.

gioreva commented 3 years ago

Also adding this keys windows path remain

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss] "AppendNtPath"=dword:00000000

Also Here HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss{d3890f4a-e8e5-40c0-8ca1-18985822d0c2}

gioreva commented 3 years ago

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss{GUID}\Flags Change flags from 7 to 5.

I've lost everything. Ubuntu has returned empty, as just installed.

And Windows path remain.

gioreva commented 3 years ago

Solved overwriting the path

~/.profile export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

eatcosmos commented 2 years ago

Working across file systems | Microsoft Docs