Skip to content

Conversation

@bandogora
Copy link

Add LIBC and adjust_libc() + minor linting

Closes #243

@bandogora
Copy link
Author

Have to adjust for static flag -s which doesn't have _libmusl prefix

@aeneasr aeneasr requested a review from Copilot January 23, 2026 12:26
@aeneasr aeneasr changed the title Add libc type check feat: support libmusl detection Jan 23, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds libc detection to the installer so it can download the correct release artifact on musl-based Linux distributions (e.g., Alpine), addressing issue #243.

Changes:

  • Introduces LIBC detection and adjust_libc() to append _libmusl to Linux artifact names when needed.
  • Updates archive name construction and logging to incorporate libc selection.
  • Applies minor formatting/linting tweaks (blank lines, shellcheck directive adjustment).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

install.sh Outdated
OS=$(uname_os)
ARCH=$(uname_arch)
PREFIX="$OWNER/$REPO"
LIBC=$(ldd --version 2>&1 | grep -qi musl && printf 'libmusl' || printf 'glibc')
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIBC detection unconditionally invokes ldd --version even on non-Linux platforms. With set -e, shells like dash may emit ldd: not found to stderr (and potentially abort) because the command-not-found error is produced by the shell and can bypass the 2>&1 redirection. Consider gating libc detection behind an OS check and is_command ldd (e.g., only detect on Linux; otherwise default to glibc/empty suffix) so macOS/Windows users don't see errors and the script stays portable.

Suggested change
LIBC=$(ldd --version 2>&1 | grep -qi musl && printf 'libmusl' || printf 'glibc')
# Detect libc variant only where applicable; default to glibc otherwise.
if [ "$OS" = "linux" ] && command -v ldd >/dev/null 2>&1; then
if ldd --version 2>&1 | grep -qi musl; then
LIBC='libmusl'
else
LIBC='glibc'
fi
else
LIBC='glibc'
fi

Copilot uses AI. Check for mistakes.
- Rename LIBC to LIBMUSL
- Add libmusl_check
  - Check $OS and `command -v ldd` before version grep
  - Return 0 or 1
- Set LIBMUSL based on libmusl_check
- adjust_libmusl now checks $LIBMUSL && $FLAVOR are not empty before setting archive name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

install.sh dowloads wrong binary on Alpine Linux (libmusl)

1 participant