mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-04-05 20:44:51 +08:00
[Fix] nvm_normalize_lts: only reject uppercase for LTS names, not regular aliases
Some checks are pending
Tests: fast / fast (zsh, mawk) (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Tests: `nvm install-latest-npm` / matrix (push) Waiting to run
Tests: `nvm install-latest-npm` / nvm install-latest-npm (push) Blocked by required conditions
Tests: linting / eclint (push) Waiting to run
Tests: linting / dockerfile_lint (push) Waiting to run
Tests: linting / doctoc (push) Waiting to run
Tests: linting / test_naming (push) Waiting to run
Tests: linting / all linting (push) Blocked by required conditions
Tests: nvm install with set -e / test (push) Blocked by required conditions
Tests: nvm install with set -e / finisher (push) Blocked by required conditions
Tests: nvm install with set -e / matrix (push) Waiting to run
Tests: release process / release (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (bash_completion, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (install.sh, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm-exec, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, dash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, ksh) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, sh) (push) Waiting to run
Tests: shellcheck / shellcheck (push) Blocked by required conditions
Tests: fast / fast (bash, gawk) (push) Waiting to run
Tests: fast / fast (dash, gawk) (push) Waiting to run
Tests: fast / fast (sh, gawk) (push) Waiting to run
Tests: fast / fast (zsh, gawk) (push) Waiting to run
Tests: fast / fast (bash, mawk) (push) Waiting to run
Tests: fast / fast (dash, mawk) (push) Waiting to run
Tests: fast / fast (sh, mawk) (push) Waiting to run
Tests: fast / all fast tests (push) Blocked by required conditions
Tests: installation_iojs / installation_iojs without curl (bash) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (dash) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (sh) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (zsh) (push) Waiting to run
Tests: installation_iojs / all installation_iojs tests (push) Blocked by required conditions
Tests: installation_node / installation_node (bash) (push) Waiting to run
Tests: installation_node / installation_node (bash, without curl) (push) Waiting to run
Tests: installation_node / installation_node (dash) (push) Waiting to run
Tests: installation_node / installation_node (dash, without curl) (push) Waiting to run
Tests: installation_node / installation_node (sh) (push) Waiting to run
Tests: installation_node / installation_node (sh, without curl) (push) Waiting to run
Tests: installation_node / installation_node (zsh) (push) Waiting to run
Tests: installation_node / installation_node (zsh, without curl) (push) Waiting to run
Tests: installation_node / all installation_node tests (push) Blocked by required conditions
Tests: xenial / xenial (bash) (push) Waiting to run
Tests: xenial / xenial (dash) (push) Waiting to run
Tests: xenial / xenial (sh) (push) Waiting to run
Tests: xenial / xenial (zsh) (push) Waiting to run
Tests: xenial / all xenial tests (push) Blocked by required conditions
urchin tests / tests (bash, installation_iojs) (push) Waiting to run
urchin tests / tests (bash, slow) (push) Waiting to run
urchin tests / tests (bash, sourcing) (push) Waiting to run
urchin tests / tests (bash, install_script) (push) Waiting to run
urchin tests / tests (dash, installation_iojs) (push) Waiting to run
urchin tests / tests (dash, slow) (push) Waiting to run
urchin tests / tests (dash, sourcing) (push) Waiting to run
urchin tests / tests (sh, installation_iojs) (push) Waiting to run
urchin tests / tests (sh, slow) (push) Waiting to run
urchin tests / tests (sh, sourcing) (push) Waiting to run
urchin tests / tests (zsh, installation_iojs) (push) Waiting to run
urchin tests / tests (zsh, slow) (push) Waiting to run
urchin tests / tests (zsh, sourcing) (push) Waiting to run
urchin tests / all test suites, all shells (push) Blocked by required conditions
update readme TOC / update readme TOC (push) Waiting to run
Tests on Windows: `nvm install` / MSYS fail prefix nvm install (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, --lts, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 11, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / tests, on windows (push) Blocked by required conditions
Tests on Windows: `nvm install` / MSYS nvm install (--default 12) (push) Waiting to run
Tests on Windows: `nvm install` / MSYS nvm install (--lts) (push) Waiting to run
Tests on Windows: `nvm install` / MSYS nvm install (--no-progress 10) (push) Waiting to run
Tests on Windows: `nvm install` / Cygwin nvm install (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, --lts, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 11, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Alpine) (push) Waiting to run
Some checks are pending
Tests: fast / fast (zsh, mawk) (push) Waiting to run
Code scanning - action / CodeQL-Build (push) Waiting to run
Tests: `nvm install-latest-npm` / matrix (push) Waiting to run
Tests: `nvm install-latest-npm` / nvm install-latest-npm (push) Blocked by required conditions
Tests: linting / eclint (push) Waiting to run
Tests: linting / dockerfile_lint (push) Waiting to run
Tests: linting / doctoc (push) Waiting to run
Tests: linting / test_naming (push) Waiting to run
Tests: linting / all linting (push) Blocked by required conditions
Tests: nvm install with set -e / test (push) Blocked by required conditions
Tests: nvm install with set -e / finisher (push) Blocked by required conditions
Tests: nvm install with set -e / matrix (push) Waiting to run
Tests: release process / release (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (bash_completion, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (install.sh, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm-exec, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, bash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, dash) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, ksh) (push) Waiting to run
Tests: shellcheck / shellcheck_matrix (nvm.sh, sh) (push) Waiting to run
Tests: shellcheck / shellcheck (push) Blocked by required conditions
Tests: fast / fast (bash, gawk) (push) Waiting to run
Tests: fast / fast (dash, gawk) (push) Waiting to run
Tests: fast / fast (sh, gawk) (push) Waiting to run
Tests: fast / fast (zsh, gawk) (push) Waiting to run
Tests: fast / fast (bash, mawk) (push) Waiting to run
Tests: fast / fast (dash, mawk) (push) Waiting to run
Tests: fast / fast (sh, mawk) (push) Waiting to run
Tests: fast / all fast tests (push) Blocked by required conditions
Tests: installation_iojs / installation_iojs without curl (bash) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (dash) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (sh) (push) Waiting to run
Tests: installation_iojs / installation_iojs without curl (zsh) (push) Waiting to run
Tests: installation_iojs / all installation_iojs tests (push) Blocked by required conditions
Tests: installation_node / installation_node (bash) (push) Waiting to run
Tests: installation_node / installation_node (bash, without curl) (push) Waiting to run
Tests: installation_node / installation_node (dash) (push) Waiting to run
Tests: installation_node / installation_node (dash, without curl) (push) Waiting to run
Tests: installation_node / installation_node (sh) (push) Waiting to run
Tests: installation_node / installation_node (sh, without curl) (push) Waiting to run
Tests: installation_node / installation_node (zsh) (push) Waiting to run
Tests: installation_node / installation_node (zsh, without curl) (push) Waiting to run
Tests: installation_node / all installation_node tests (push) Blocked by required conditions
Tests: xenial / xenial (bash) (push) Waiting to run
Tests: xenial / xenial (dash) (push) Waiting to run
Tests: xenial / xenial (sh) (push) Waiting to run
Tests: xenial / xenial (zsh) (push) Waiting to run
Tests: xenial / all xenial tests (push) Blocked by required conditions
urchin tests / tests (bash, installation_iojs) (push) Waiting to run
urchin tests / tests (bash, slow) (push) Waiting to run
urchin tests / tests (bash, sourcing) (push) Waiting to run
urchin tests / tests (bash, install_script) (push) Waiting to run
urchin tests / tests (dash, installation_iojs) (push) Waiting to run
urchin tests / tests (dash, slow) (push) Waiting to run
urchin tests / tests (dash, sourcing) (push) Waiting to run
urchin tests / tests (sh, installation_iojs) (push) Waiting to run
urchin tests / tests (sh, slow) (push) Waiting to run
urchin tests / tests (sh, sourcing) (push) Waiting to run
urchin tests / tests (zsh, installation_iojs) (push) Waiting to run
urchin tests / tests (zsh, slow) (push) Waiting to run
urchin tests / tests (zsh, sourcing) (push) Waiting to run
urchin tests / all test suites, all shells (push) Blocked by required conditions
update readme TOC / update readme TOC (push) Waiting to run
Tests on Windows: `nvm install` / MSYS fail prefix nvm install (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, --lts, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 11, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / tests, on windows (push) Blocked by required conditions
Tests on Windows: `nvm install` / MSYS nvm install (--default 12) (push) Waiting to run
Tests on Windows: `nvm install` / MSYS nvm install (--lts) (push) Waiting to run
Tests on Windows: `nvm install` / MSYS nvm install (--no-progress 10) (push) Waiting to run
Tests on Windows: `nvm install` / Cygwin nvm install (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 10, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 12, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 14, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 16, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 18, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 14, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-18.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 16, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 18, Ubuntu-20.04) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 21, Debian) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (, 21, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, --lts, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 10, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 11, Alpine) (push) Waiting to run
Tests on Windows: `nvm install` / WSL nvm install (script, 12, Alpine) (push) Waiting to run
The lowercase check was in the `*` catch-all branch of the `case` statement, rejecting any alias name with uppercase characters.
This prevented creating or reading uppercase aliases like `TESTY`.
The check should only apply to `lts/*` patterns, since LTS codenames are always lowercase.
Fixes #3764.
Bug introduced in 9fb9dec710 as part of fixing #3417.
This commit is contained in:
12
nvm.sh
12
nvm.sh
@@ -935,10 +935,14 @@ nvm_normalize_lts() {
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ "${LTS}" != "$(echo "${LTS}" | command tr '[:upper:]' '[:lower:]')" ]; then
|
||||
nvm_err 'LTS names must be lowercase'
|
||||
return 3
|
||||
fi
|
||||
case "${LTS}" in
|
||||
lts/*)
|
||||
if [ "${LTS}" != "$(echo "${LTS}" | command tr '[:upper:]' '[:lower:]')" ]; then
|
||||
nvm_err 'LTS names must be lowercase'
|
||||
return 3
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
nvm_echo "${LTS}"
|
||||
;;
|
||||
esac
|
||||
|
||||
37
test/fast/Aliases/uppercase alias names should work
Executable file
37
test/fast/Aliases/uppercase alias names should work
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/bin/sh
|
||||
|
||||
die () { echo "$@" ; cleanup ; exit 1; }
|
||||
|
||||
cleanup() {
|
||||
rm -f "$(nvm_alias_path)/UPPER_ALIAS"
|
||||
rm -f "$(nvm_alias_path)/MixedCase"
|
||||
}
|
||||
|
||||
: nvm.sh
|
||||
\. ../../../nvm.sh
|
||||
|
||||
\. ../../common.sh
|
||||
|
||||
make_fake_node v0.0.1
|
||||
|
||||
# Uppercase alias should be created and readable
|
||||
nvm alias UPPER_ALIAS v0.0.1
|
||||
[ -f "$(nvm_alias_path)/UPPER_ALIAS" ] || die "uppercase alias file should exist"
|
||||
|
||||
try nvm_alias UPPER_ALIAS
|
||||
[ "${CAPTURED_EXIT_CODE}" = "0" ] || die "nvm_alias should succeed for uppercase alias, got exit code ${CAPTURED_EXIT_CODE}"
|
||||
[ "${CAPTURED_STDOUT}" = "v0.0.1" ] || die "nvm_alias UPPER_ALIAS should return v0.0.1, got ${CAPTURED_STDOUT}"
|
||||
|
||||
# Mixed case should also work
|
||||
nvm alias MixedCase v0.0.1
|
||||
[ -f "$(nvm_alias_path)/MixedCase" ] || die "mixed case alias file should exist"
|
||||
|
||||
try nvm_alias MixedCase
|
||||
[ "${CAPTURED_EXIT_CODE}" = "0" ] || die "nvm_alias should succeed for mixed case alias, got exit code ${CAPTURED_EXIT_CODE}"
|
||||
|
||||
# LTS names with uppercase should still be rejected
|
||||
try_err nvm_normalize_lts "lts/ARGON"
|
||||
[ "${CAPTURED_EXIT_CODE}" = "3" ] || die "uppercase LTS name should fail with exit code 3, got ${CAPTURED_EXIT_CODE}"
|
||||
[ "${CAPTURED_STDERR}" = "LTS names must be lowercase" ] || die "expected lowercase error, got ${CAPTURED_STDERR}"
|
||||
|
||||
cleanup
|
||||
Reference in New Issue
Block a user