WSL icon indicating copy to clipboard operation
WSL copied to clipboard

Spaces in windows PATH break when appendWindowsPath is true

Open cooperoptigrid opened this issue 1 month ago • 3 comments

Windows Version

Microsoft Windows [Version 10.0.26200.7171]

WSL Version

2.5.9.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

6.6.87.2-1

Distro Version

Ubuntu 24.04

Other Software

VS Code - 1.106.2 Cursor - 2.1.25

Repro Steps

>>> code .
command code not found
>>> cursor .
command cursor not found

Expected Behavior

>>> code .  # opens VS Code
>>> cursor .  # opens Cursor

Actual Behavior

>>> code .
command code not found
>>> cursor .
command cursor not found

Diagnostic Logs

>>> echo $PATH
# ... bunch of normal linux paths like /usr/bin]
# broken Windows Paths, note ":" where spaces should be
/mnt/c/Program:Files/dotnet/:Files/Git/cmd:Files/Amazon/AWSCLIV2/:/Docker/host/bin:Files/cursor/resources/app/bin:Files/PowerShell/7/:/mnt/c/Users/Cooper/.local/bin:/mnt/c/Users/Cooper/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Cooper/AppData/Local/Programs/Microsoft:VS:Code/bin:
# bunch of other stufff

A workaround is for me to manually add the correct paths to my .bashrc

# temporary, hopefully. not sure why this suddenly stopped working...
export PATH="$PATH:/mnt/c/Users/Cooper/AppData/Local/Programs/Microsoft VS Code/bin"
export PATH="$PATH:/mnt/c/Program Files/cursor/resources/app/bin"

This make it work!

This was never a problem until I restarted my device recently (and presumbaly some updates were applied).

cooperoptigrid avatar Nov 27 '25 23:11 cooperoptigrid

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions[bot] avatar Nov 27 '25 23:11 github-actions[bot]

/emailed-logs

cooperoptigrid avatar Nov 28 '25 00:11 cooperoptigrid

Diagnostic information
Found '/emailed-logs', adding tag 'emailed-logs'

github-actions[bot] avatar Nov 28 '25 00:11 github-actions[bot]

Thank you for reporting this @cooperoptigrid.

Could you share which PATH you have set in that shell ? I wonder if there's a parsing bug in wsl.exe.

For PowerShell:

echo $env:PATH

For cmd.exe:

path

OneBlue avatar Dec 02 '25 22:12 OneBlue

@OneBlue here it is

PS C:\Users\CooperEllidge> echo $env:PATH
C:\Program Files\PowerShell\7;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\Amazon\AWSCLIV2\;C:\Program Files\cursor\resources\app\bin;C:\Program Files\PowerShell\7\;C:\Program Files\Docker\Docker\resources\bin;C:\Users\CooperEllidge\.local\bin;C:\Users\CooperEllidge\AppData\Local\Microsoft\WindowsApps;C:\Users\CooperEllidge\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\CooperEllidge\AppData\Local\Microsoft\WinGet\Packages\Gruntwork.Terragrunt_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\CooperEllidge\AppData\Local\Microsoft\WinGet\Packages\Hashicorp.Terraform_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\CooperEllidge\AppData\Local\Programs\Zed\bin

cooperoptigrid avatar Dec 08 '25 23:12 cooperoptigrid

This is also affecting me.

Also, not sure if related, as I don't know if this was being parsed properly before (recently started using WSL). Vscode sets "terminal.integrated.env.linux" but it is not parsing vscode config vars:

vscode config: "terminal.integrated.env.linux": { "PATH": "${env:PATH}:${workspaceRoot/bin}", }
bash $PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:${workspaceRoot/bin}:/snap/bin: No such file or directory

this works fine in a native vscode install, so maybe this is on vscode remote server

Regards

dimateos avatar Dec 15 '25 09:12 dimateos

Thank @cooperoptigrid. I can't reproduce the issue directly in WSL, so just checking, if you run wsl.exe outside of vscode, do you see the same issue or do things work as expected ?

OneBlue avatar Dec 17 '25 00:12 OneBlue

If I restart my computer, and open the Windows Terminal app with the Ubuntu shell then run the commands as above it doesn’t work.

@dimateos my workaround is to disable auto loading the env and then manually setting my WSL PATH in my .bashrc

cooperoptigrid avatar Dec 17 '25 09:12 cooperoptigrid