install.sh: detect musl on non-Alpine distros
RO
2mo ago+80+80+01234567890123456789-0-0-0123456789
Problem
curl -fsSL https://bun.com/install | bashinstalls the glibc build on non-Alpine musl systems. The binary then fails to load:Error relocating /root/.bun/bin/bun: gnu_get_libc_version: symbol not found.- The cause is the musl check in
src/runtime/cli/install.sh:89. It only tests for/etc/alpine-release. Gentoo musl, Void musl, and Chimera do not have that file, so the script picksbun-linux-aarch64.zipinstead ofbun-linux-aarch64-musl.zip.
Fix
- Add two fallback probes after the Alpine check: a
/lib/ld-musl-*.so.1loader file, andldd --versionoutput that containsmusl. - The loader file check cannot use the glibc loader path in reverse. gcompat provides a glibc-style loader on musl systems, as the reporter's
lddoutput shows. - The
lddprobe uses a command substitution with|| true, not a pipe intogrep. musl'sldd --versionexits non-zero, and the script runs underset -o pipefail. - Verified:
test/cli/install-script.test.ts(new). It runs the real script with stubunameandlddbinaries and a local server in place of GitHub, and asserts which release asset the script requests. The musl test fails on the unpatched script.
Background
- The install script maps
uname -msto a release target, then appends-muslfor musl systems. The musl zip exists for both x64 and aarch64 (.buildkite/scripts/upload-release.sh). - The npm installer is not affected.
packages/bun-release/src/platform.tsdetects musl fromprocess.report, which is distro independent. That is whynpm install -g bunworks on the reporter's system.
Fixes #40975
no test proof · iteration 0 · platform-specific test(s) that do not run on this machine, deferring to CI, which covers all platforms: test/cli/install-script.test.ts