Skip to content

mise.run downloads the wrong musl/glibc build #1716

@splinter98

Description

@splinter98

Describe the bug
When downloading mise using https://mise.run | sh it downloads and uses the incorrect libc build.

on OS with glibc it downloads musl builds and on musl OSes it downloads glibc builds.

Whilst musl builds will work on glibc OSes it will then also install musl pre-builds of python which will surprise users when installing packages from pypi.

To Reproduce
On any linux machine that uses glibc

$ curl https://mise.run | sh
$ ldd ~/.local/bin/mise
    statically linked

On Alpine (a MUSL build)

$ curl https://mise.run | sh
$ ldd ~/.local/bin/mise
Error loading shared library libgcc_s.so.1: No such file or directory (needed by /root/.local/bin/mise)
        librt.so.1 => /lib64/ld-linux-x86-64.so.2 (0x7f48b721e000)
        libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f48b721e000)
        libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f48b721e000)
        libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f48b721e000)
        libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f48b721e000)

Expected behavior
On Glibc linux

$ ldd ~/.local/bin/mise
        linux-vdso.so.1 (0x00007ffd27f0c000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f26cafd6000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f26cafd1000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f26cafcc000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f26caee5000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f26caee0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f26cacb7000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f26cc29a000)

on Alpine:

$ curl https://mise.run | sh
$ ldd ~/.local/bin/mise
    statically linked

mise doctor output

Not Applicable

Additional context
A quick read of packaging/standalone/install.envsubst#L45 suggests that the logic is inverted:

if type ldd >/dev/null 2>/dev/null; then
	libc=$(ldd /bin/ls | grep 'musl' | head -1 | cut -d ' ' -f1)
	if [ -z "$libc" ]; then
		musl="-musl"
	fi
fi

We're checking to see if musl is in /bin/ls however the -z is testing if empty and then appends the -musl. But this logic should be the otherway around.

Whilst the fix is simple, we also may want to warn users if they've got the incorrect of python installed (or any other tool that has similar logic).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions