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

Fix path handling in cd #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

padiakalpesh
Copy link

@padiakalpesh padiakalpesh commented Apr 11, 2024

The use of $* prevents correctly cd'ing into a directory with spaces in its path name since each segment of the name around the space is treated as if it is a separate argument.

Example:
"dir/path with spaces" is treated as dir/path and with and spaces. This causes cd to fail. It also causes __gvm_oldcd to fail, although call to builtin cd will succeed.

Same issue happens if path is specified as dir/path\ with\ spaces.

This patch fixes this issue by using "$@" to correctly handle spaces.

Fixes #457

The use of `$*` prevents correctly cd'ing into a directory with spaces in its path name since each segment of the name around the space is treated as if it is a separate argument. 

Example:
`"dir/path with spaces"` is treated as `dir/path` and `with` and `spaces`. This causes `cd` to fail. It also causes `__gvm_oldcd` to fail, although call to `builtin cd` will succeed.

Same issue happens if path is specified as `dir/path\ with\ spaces`. 

This patch fixes this issue by using "$@" to correctly handle spaces.
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

Successfully merging this pull request may close these issues.

Overriden cd fails to switch to paths with spaces
1 participant