Skip to content
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

Colon Used as Spaces in Linux PATH #10399

Closed
1 of 2 tasks
pchang388 opened this issue Aug 17, 2023 · 3 comments
Closed
1 of 2 tasks

Colon Used as Spaces in Linux PATH #10399

pchang388 opened this issue Aug 17, 2023 · 3 comments

Comments

@pchang388
Copy link

Windows Version

Microsoft Windows 11 Enterprise [10.0.22000 Build 22000]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 5.15.90.1-microsoft-standard-WSL2 (oe-user@oe-host) (x86_64-msft-linux-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 SMP Fri Jan 27 02:56:13 UTC 2023

Distro Version

Ubuntu 22.04

Other Software

Rancher Desktop v1.9.1
Visual Studio Code

Repro Steps

  • Install WSL2 using Ubuntu distro in microsoft app store
  • Install Rancher Desktop
  • Install Visual Studio Code and WSL extension
  • Install helper programs like gvm and pyenv, update path accordingly in .bashrc
  • see $PATH output:
$ echo $PATH
/home/changpeter/.gvm/pkgsets/go1.21.0/global/bin:/home/changpeter/.gvm/gos/go1.21.0/bin:/home/changpeter/.gvm/pkgsets/go1.21.0/global/overlay/bin:/home/changpeter/.gvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program:Files:(x86)/RSA:SecurID:Token:Common:Files/RSA:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:Files/dotnet/:/mnt/c/Users/Peter_Chang1/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/Peter_Chang1/AppData/Local/Programs/Microsoft:VS:Code/bin:/mnt/c/Users/Peter_Chang1/AppData/Local/Programs/Rancher:Desktop/resources/resources/win32/bin/:Desktop/resources/resources/linux/bin/:/snap/bin
  • See Colons used instead of Spaces
/mnt/c/Users/Peter_Chang1/AppData/Local/Programs/Microsoft:VS:Code/bin:/mnt/c/Users/Peter_Chang1/AppData/Local/Programs/Rancher:Desktop/resources/resources/win32/bin/:Desktop/resources/resources/linux/bin/
  • Try to cd to directory inside /mnt drive
/mnt/c/Users/Peter_Chang1/AppData/Local/Programs$ ls -lrt
total 0
drwxrwxrwx 1 changpeter changpeter 512 Aug 15 20:47  Common
drwxrwxrwx 1 changpeter changpeter 512 Aug 15 20:48 'Microsoft VS Code'
drwxrwxrwx 1 changpeter changpeter 512 Aug 15 20:59 'Rancher Desktop'

/mnt/c/Users/Peter_Chang1/AppData/Local/Programs$ cd 'Rancher Desktop'/
-bash: cd: too many arguments

/mnt/c/Users/Peter_Chang1/AppData/Local/Programs$ cd "Rancher Desktop"
-bash: cd: too many arguments

Expected Behavior

Two issues:

  • We should be able to navigate to /mnt (windows) folders with spaces using proper escape or quotes
  • We should not have colons for spaces in linux $PATH variable

Actual Behavior

  • Cannot navigate to specific folders with spaces in them in /mnt
  • Cannot find binaries or scripts in our PATHs due to colons

Diagnostic Logs

No response

@pchang388
Copy link
Author

For what it's worth, this is a corporate laptop and did not have this issue with similar setups on my personal desktop

@pchang388
Copy link
Author

Showing wsl conf values, default nothing added:

$ cat /etc/wsl.conf

[boot]
systemd=true

@pchang388
Copy link
Author

I found the issue only occurs when I install GVM (golang version manager) on Ubuntu WSL2, it seems to change the PATH to include those colons and also does something very weird, I didn't save the log message unfortunately but can see this when I check the cd command

Normal response

$ type cd
cd is a shell builtin

When GVM installed:

cd is a function...

... some code for GVM specific operations ...

Essentially gvm at least in current latest version rewrites the cd builtin command with it's own for some reason which is not expected imo and makes it unusable. It shouldn't be doing that at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant