Repository navigation
Fix for $path used by zsh - #1669
Conversation
"The lower-case version of PATH is an array parameter bound to the scalar upper-case parameter." -- http://www.zsh.org/mla/users/2015/msg00178.html
|
Thanks; can you add a test that would have failed with this change? |
The "\printf" calls zsh shell builtin instead of `command printf` in scripting. The workaround is no longer needed given 91a29c0.
ljharb
left a comment
There was a problem hiding this comment.
Any possibility of an explicit test for this behavior?
| command printf %s\\n "$*" 2>/dev/null || { | ||
| nvm_echo() { | ||
| # shellcheck disable=SC1001 | ||
| \printf %s\\n "$*" # on zsh, `command printf` sometimes fails |
There was a problem hiding this comment.
wow, is the implication here that this failure is solely based on using a var named "path" in nvm_find_up??
If so, then I think that shellcheck should warn for variables named path when set to zsh mode - that would have caught this issue much sooner. I'll file one :-) Update: I filed koalaman/shellcheck#1058, but turns out shellcheck doesn't care about zsh.
There was a problem hiding this comment.
I'm not sure. Just a guess, and it seems OK after removing the code. (Tests are passed.)
The backslash inactivates alias and has no effect in scripting.
Thus this snippet works as "use shell builtin when command fails".
Note: I just noticed that:
command printf in bash: is shell builtin in bash
command printf in zsh: is command /usr/bin/printf
|
This bug should have been found by |
Fixes - fix unassigned variable (nvm-sh#1665, nvm-sh#1664) - Fix for $path used by zsh (nvm-sh#1669) - `set -u`: ensure `NVM_USE_OUTPUT` is always set (nvm-sh#1671) - `install.sh`: Fix a bug that block that installation of node in install.sh (nvm-sh#1676) - `nvm install-latest-npm`: fix node 4-4.6 Documentation - Make `nvm cache clear` message less ambiguous (nvm-sh#1644) - Added missing piece (nvm-sh#1658)
Fix for $path used by zsh
Fixes - fix unassigned variable (nvm-sh#1665, nvm-sh#1664) - Fix for $path used by zsh (nvm-sh#1669) - `set -u`: ensure `NVM_USE_OUTPUT` is always set (nvm-sh#1671) - `install.sh`: Fix a bug that block that installation of node in install.sh (nvm-sh#1676) - `nvm install-latest-npm`: fix node 4-4.6 Documentation - Make `nvm cache clear` message less ambiguous (nvm-sh#1644) - Added missing piece (nvm-sh#1658)
The
$pathis used by zsh itself.Rename
pathtopath_.Ref:
"The lower-case version of PATH is an array parameter
bound to the scalar upper-case parameter."
-- http://www.zsh.org/mla/users/2015/msg00178.html