Skip to content

fix: do not report musl on Alpine images running glibc - #1475

Open
ChrisJr404 wants to merge 1 commit into
xerial:masterfrom
ChrisJr404:fix/no-musl-on-alpine-glibc-1474
Open

ChrisJr404 wants to merge 1 commit into
xerial:masterfrom
ChrisJr404:fix/no-musl-on-alpine-glibc-1474

Conversation

@ChrisJr404

Copy link
Copy Markdown

Fixes #1474

Problem

On an Alpine-based image that ships glibc (not musl), OSInfo.isMusl() returns true and sqlite-jdbc selects the Linux-Musl native library, which then fails to load on glibc.

The cause is the isMusl() fallback. When /proc/self/map_files has no entry resolving to a musl path, isMusl() falls back to isAlpineLinux(), which returns true for any /etc/os-release line that starts with ID and contains alpine. Images such as bellsoft/hardened-liberica-runtime-container:...-glibc have ID_LIKE=alpine and LIBC_TYPE=glibc, so the fallback reports musl even though the runtime libc is glibc.

Fix

Honor LIBC_TYPE=glibc in /etc/os-release. The os-release check now reports musl only when the file marks an Alpine system (ID/ID_LIKE contains alpine) and does not also declare LIBC_TYPE=glibc. A standard musl Alpine image (no LIBC_TYPE) is still detected as musl, so the existing behavior is preserved.

Tests

Added testMuslDetectionFromOsRelease to OSInfoTest, covering three os-release cases: a real musl Alpine image (true), an Alpine-based glibc image with LIBC_TYPE=glibc (false, the regression), and a non-Alpine distribution (false).

mvn test -Dtest=OSInfoTest passes (13 tests, 0 failures).

@gotson

gotson commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

thanks for the PR, can you check the code formatting failing and fix via mvn spotless:apply ?

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.

OSInfo.isMusl() misdetects musl on Alpine-based images that run glibc

2 participants