moovweb / gvm

Go Version Manager
http://github.com/moovweb/gvm
MIT License
9.87k stars 520 forks source link

Path incorrectly modified by GVM script #466

Open andrew-ttd opened 4 months ago

andrew-ttd commented 4 months ago

After installing GVM the line below was added to my .zshrc:

[[ -s "/Users/andrew.oh/.gvm/scripts/gvm" ]] && source "/Users/andrew.oh/.gvm/scripts/gvm"

This script seems to incorrectly update my PATH environment variable by replacing spaces ` with:`. For example:

> env

PATH=...:/Users/me/Library/Application:Support/JetBrains/Toolbox/scripts

GVM_PATH_BACKUP=...:/Users/me/Library/Application Support/JetBrains/Toolbox/scripts
theunrepentantgeek commented 3 months ago

I'm seeing the same behaviour, but in this case it's mangling the path for VS Code:

In GVM_PATH_BACKUP: /mnt/c/Users/bearps/AppData/Local/Programs/Microsoft VS Code/bin

In PATH: /mnt/c/Users/bearps/AppData/Local/Programs/Microsoft:VS:Code/bin

The version I'm running:

$ gvm version
Go Version Manager v1.0.22 installed at /home/bevan/.gvm
caioreix commented 3 months ago

Same problem here, gvm is replacing spaces with :

zalom commented 3 months ago

Ditto. I spent a day debugging to see why code does not work when called from the terminal on WSL. The conclusion is the same, colon (:) replaces spaces.

Also, it replaces cd as well.

(before gvm scripts mod)

❯ type cd
cd is a shell builtin

(after gvm scripts mod)

❯ type cd
cd is a shell function from /home/zlatko/.gvm/scripts/env/cd
caioreix commented 3 months ago

@zalom i found a solution, just the space from this path ~/.gvm/scripts/function/munge_path line 51. Something like this IFS=':' path_in_ary=( $(printf "%s" "${path_in}") ) IFS="$defaultIFS"

zalom commented 3 months ago

@zalom i found a solution, just the space from this path ~/.gvm/scripts/function/munge_path line 51. Something like this IFS=':' path_in_ary=( $(printf "%s" "${path_in}") ) IFS="$defaultIFS"

Thanks man!

Ivan-Parushev commented 1 month ago

This works for me. Thanks @caioreix !

Is this a typo or for some reason it is meant to be ': '? If its just a mistake maybe somebody can make a quick PR and fix it permanently?