Skip to content
Myr

[Robustness] `nvm_get_arch`: only apply the Alpine musl suffix when the OS is linux

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The `/etc/alpine-release` check applied the -musl suffix regardless of the resolved OS. In practice Alpine is always linux, so this is behavior-neutral, but it also makes the `nvm_get_arch` unit test hermetic: its mocked smartos/osx cases no longer pick up a real host's Alpine marker.

authored by Jordan Harband · committed by Jordan Harband · parent ce157c1 · Browse files · 1 file+1 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−1 removed

  • other:+1 added−1 removed

1 file+1 added−1 removed

modified:nvm.sh+1 added-1 removed
2249 unmodified lines
2250 NVM_ARCH=armv7l2251 HOST_ARCH=armv7l2252 fi22532254 if [ -f "/etc/alpine-release" ]; then2254 if [ -f "/etc/alpine-release" ] && [ "_${NVM_OS}" = "_linux" ]; then2255 # Alpine Linux uses musl libc; map to musl variants where available2256 # See https://unofficial-builds.nodejs.org/download/release/2257 case "${NVM_ARCH}" in2258 x64) NVM_ARCH=x64-musl ;;
2694 unmodified lines