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

Path incorrectly modified by GVM script #466

Open
andrew-ttd opened this issue Mar 4, 2024 · 8 comments
Open

Path incorrectly modified by GVM script #466

andrew-ttd opened this issue Mar 4, 2024 · 8 comments

Comments

@andrew-ttd
Copy link

andrew-ttd commented Mar 4, 2024

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
Copy link

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
Copy link

Same problem here, gvm is replacing spaces with :

@zalom
Copy link

zalom commented Mar 27, 2024

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
Copy link

@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
Copy link

zalom commented Mar 27, 2024

@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
Copy link

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?

@kaxxa123
Copy link

kaxxa123 commented Jul 17, 2024

Installed gvm today and had the same problem.
Windows 10
WSL2 (Ubuntu 22.04)
Go Version Manager v1.0.22

Removing the extra space in line 51 of ~/.gvm/scripts/function/munge_path does not work for me.

Also further to what was already reported (replacement of spaces with a colon), Looking closely at the changes made to the PATH. I can see that many of my paths were simply chopped off. Here are some examples

FROM:
/mnt/c/Program Files/Eclipse Adoptium/jdk-8.0.382.5-hotspot/bin
/mnt/c/Program Files/nodejs

TO:
Adoptium/jdk-8.0.382.5-hotspot/bin
Files/nodejs

So the problem is not limited with replacing spaces with colon. Some paths simply get chopped off at a space.

@Heunsig
Copy link

Heunsig commented Aug 7, 2024

@kaxxa123 I think this could be the solution.
#486 (comment)

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

7 participants