Repository navigation
Overriden cd fails to switch to paths with spaces #457
Description
Activity
Faced the similar issue
Have the same issue
After install gvm my cd stopped to work, if run any
cd somethingand nothing happens.
To solve that for now I deleted$HOME/.gvm/scripts/env/cdscript to use the default linux cd.
That gvm cd script is really need?Reacted by Benyamin Limanto and JoThe same issue
- added a commit that references this issue
on Feb 6, 2024 - added a commit that references this issue
on Apr 6, 2024 After install gvm my cd stopped to work, if run any
cd somethingand nothing happens. To solve that for now I deleted$HOME/.gvm/scripts/env/cdscript 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)
Reacted by CarlosHleb and JoReacted by JoThis was totally unexpected and borks PATH in wsl 2 on windows as well.
Reacted by obs-gh-deniszvonov, CarlosHleb, Mark Garrison and David DelassusI have this issue. I disabled the last command in the
scripts/gvm-defaultfile:. "$GVM_ROOT/scripts/env/cd" && cd .
When I inspected the code I noticed there's a
cdoverride 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.Reacted by José Riguera Lopez , CarlosHleb, Aten Jin and Aydar KarimovI have this issue. I disabled the last command in the
scripts/gvm-defaultfile:. "$GVM_ROOT/scripts/env/cd" && cd .
When I inspected the code I noticed there's a
cdoverride 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
cdcommand no longer working, without any error
Thanks for your help, I did the same :)Reacted by Matthew Blott, Aten Jin and JoSame for me.
If I manually edit
~/.gvm/scripts/env/cdwith the fixes from #482 , the issue no longer happens, so I guess that the issue should be fixed as soon as that PR is mergedIt 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 :(
Reacted by Aten Jin and AbdullReacted by Aten Jin and AbdullTo check if you are affected by this issue while using Bash, run the following command:
type -a cd(see Bash Builtin Commands:type.If
type -a cdoutputs the following ...cd is a function # ... contents similar to https://github.com/moovweb/gvm/blob/dd652539fa4b771840846f8319fad303c7d0a8d2/scripts/env/cd # ... cd is a shell builtinthen execute
unset -f cd(see Bourne Shell Builtins:unsetin order to "reset"cdback to its original form. Then try cd-ing again and see if the problem is fixed for the moment.Also for emergency this will work in bash. This will bypass the function and use the builtin.
builtin cd "A directory with spaces"
Reacted by Abdull- added 2 commits that reference this issue
on Sep 15, 2025 Why does gvm need to override
cd?Reacted by Matthew Blott, Maximiliano Moraes, Kharis Khasburrahman, Gustavo Vasconcelos and Pieter OliverRemoved this and will tell everyone I know to avoid. Why would you do this?


When attempting to use the
cdcommand 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:
Environment: