Commit Graph
7 Commits
Author SHA1 Message Date
Jordan Harband d639676bb0 [Fix] nvm_is_version_installed: fail when nvm_version_path fails
Since 072622c7, `nvm_version_path` rejects a version with a `..` path component, printing nothing and returning 3.

`nvm_is_version_installed` ignored that status and appended `/bin/node` to the empty output,
so for such a version (eg, `v/../x` in an `.nvmrc`)
it checked `/bin/node`,
and reported the version as installed whenever a system node lived there.
`nvm use` then put `/bin` in place of the active version on `PATH`,
and `nvm which` printed `/bin/node`.

Propagate `nvm_version_path`'s failure,
so such a version is never installed

Discovered by Anthropic's OSS Scanner, as bug ANT-2026-O1QONH45; the scanner correctly classified it as not a vulnerability.
2026-10-22 20:10:42 -07:00
Cassidy Marble d211d5fdb8 [Perf] nvm_is_version_installed: check the modern layout's path before the full lookup 2026-10-06 12:43:22 -03:00
Jordan Harband c451e7a4c8 [Tests] set $_ before sourcing nvm.sh in fast tests
nvm.sh uses `NVM_SCRIPT_SOURCE="$_"` to detect its source location.
Adding `: nvm.sh` before each source line ensures `$_` is set correctly, preventing breakage when the previous command (e.g., `set -ex`) overwrites it.
2026-01-26 21:41:57 -08:00
Noritaka Kobayashi 4d364c2e7b [readme] fix typo 2025-10-18 10:28:48 +09:00
Jordan Harband 863bd63cfa [Tests] set proper permissions on test files 2024-08-23 17:23:12 -07:00
nmarghetti f2582275f6 [New] maybe support Windows with WSL, MSYS, Cygwin 2021-01-02 00:03:24 +01:00
nmarghetti d118be8fd4 [Tests] Add unit tests for nvm_is_version_installed 2021-02-21 18:48:43 +01:00