gvm icon indicating copy to clipboard operation
gvm copied to clipboard

Overriden cd fails to switch to paths with spaces

Open paulourio opened this issue 1 year ago • 11 comments

When attempting to use the cd command in bash, which runs $HOME/.gvm/scripts/env/cd, to navigate to a directory with spaces in its name, the operation fails with the error message "bash: cd: too many arguments." The expected behavior is a successful navigation to directories with spaces in their names.

How to reproduce:

  1. With initialized GVM, create a directory with spaces in its name:
mkdir -p '~/foo bar'
cd '~/foo bar'
  1. The following error is encountered:
bash: cd: too many arguments

Environment:

  • Operating System: GNU/Linux
  • GVM Version: 1.0.22
  • Bash Version: 5.1.16(1)-release

paulourio avatar Dec 09 '23 10:12 paulourio

Faced the similar issue

haha4github avatar Dec 11 '23 01:12 haha4github

Have the same issue

cmodk avatar Dec 26 '23 07:12 cmodk

After install gvm my cd stopped to work, if run any cd something and nothing happens. To solve that for now I deleted $HOME/.gvm/scripts/env/cd script to use the default linux cd. That gvm cd script is really need?

albertosouza avatar Jan 22 '24 12:01 albertosouza

The same issue

M4n5ter avatar Jan 31 '24 11:01 M4n5ter

After install gvm my cd stopped to work, if run any cd something and nothing happens. To solve that for now I deleted $HOME/.gvm/scripts/env/cd script to use the default linux cd. That gvm cd script is really need?

I tried to delete that but seems it broke the improt of the "cd" in gvm file, could you please also point out where the import of the cd is?

Thank you

EDIT: NVM, I delete the row in .gvm/scripts/gvm-default at last row and it solved by itself... (for now for my own bash)

benyaminl avatar Apr 24 '24 03:04 benyaminl

This was totally unexpected and borks PATH in wsl 2 on windows as well.

See https://github.com/microsoft/WSL/issues/10399

joes avatar May 06 '24 11:05 joes

I have this issue. I disabled the last command in the scripts/gvm-default file:

. "$GVM_ROOT/scripts/env/cd" && cd .

When I inspected the code I noticed there's a cd override function. That seems a bit dangerous to me! I'm on macOS but I'm using bash. I haven't tried with zsh but I suspect it's the same.

matthewblott avatar May 29 '24 13:05 matthewblott

I have this issue. I disabled the last command in the scripts/gvm-default file:

. "$GVM_ROOT/scripts/env/cd" && cd .

When I inspected the code I noticed there's a cd override function. That seems a bit dangerous to me! I'm on macOS but I'm using bash. I haven't tried with zsh but I suspect it's the same.

I had the cd command no longer working, without any error Thanks for your help, I did the same :)

jbdemonte avatar Jul 14 '24 21:07 jbdemonte

Same for me.

palonsoro avatar Jul 20 '24 11:07 palonsoro

If I manually edit ~/.gvm/scripts/env/cd with the fixes from https://github.com/moovweb/gvm/pull/482 , the issue no longer happens, so I guess that the issue should be fixed as soon as that PR is merged

palonsoro avatar Jul 20 '24 11:07 palonsoro

It looks like this repo hasn't seen any commits in almost a year, so manually applying my fix from #482 may be the only option :(

yithian avatar Jul 22 '24 12:07 yithian