ohmyzsh: Changing `$PATH` after `gnu-utils` plugin has loaded breaks functionality
Describe the bug
Hello,
I have a problem on macOS with gnu-utils plugin. It works fine with this minimal .zshrc file:
export ZSH="/Users/test/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(
gnu-utils
)
source $ZSH/oh-my-zsh.sh
But, when I add the pyenv plugin, gnu-utils plugin seems to break. Minimal non-working .zshrc file:
export ZSH="/Users/test/.oh-my-zsh"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
ZSH_THEME="robbyrussell"
plugins=(
gnu-utils
pyenv
)
source $ZSH/oh-my-zsh.sh
Demonstration:
➜ ~ mkdir -v test
mkdir: created directory 'test'
➜ ~ rm test -rfv
rm: test: is a directory
rm: -rfv: No such file or directory
➜ ~ rm -rfv test
test
Steps to reproduce
Enable gnu-utils and pyenv plugin.
Run the following commands:
➜ ~ mkdir -v test
mkdir: created directory 'test'
➜ ~ rm test -rfv
rm: test: is a directory
rm: -rfv: No such file or directory
Expected behavior
Gnu version of rm should be used, and the -rfv args must be accepted at the end of the line.
Screenshots and recordings
No response
OS / Linux distribution
macOS 11.6
Zsh version
5.8
Terminal emulator
iTerm2
If using WSL on Windows, which version of WSL
No response
Additional context
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- Merge remote-tracking branch 'officialorigin/master' into maojj * officialorigin/master: style: use 24bit colors in Oh My Zsh logo if supported fix(cli): follow symlinks in plugin or theme comple... — committed to maojj/oh-my-zsh by deleted user 2 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to amkirby/oh-my-zsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to cmoore/oh-my-zsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to FelixDombek/ohmyzsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to Daddelhai/ohmyzsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to kis87988/ohmyzsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to tekniklr/oh-my-zsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to dilfish/oh-my-zsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to nbaronov/oh-my-zsh by mcornella 3 years ago
- fix(gnu-utils): reassign GNU utils on `preexec` (#10535) The previous version rebound the `hash` and `rehash` builtins to reassing GNU utils when they were called. This didn't take into account that ... — committed to ferdnyc/ohmyzsh by mcornella 3 years ago
I solved the issue by reassigning the GNU utils on every command execution, if they aren’t already assigned. You should be good to go now if you
omz update.@ardeidae I can’t reproduce your problem in macOS 10.15. You could generate a trace of the zsh initialization (with the configuration that makes the plugin fail) and post it here. You can do that with
zsh -xvic exit &> ~/omz-debug.log.Not that this will contain sensitive info like the user and host names. If you prefer, you can email it to me at marc@ohmyz.sh.