File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -141,22 +141,35 @@ curl_with_error_handling() {
141141
142142# Detect libc type on Linux (gnu or musl)
143143detect_libc () {
144- # Check for musl dynamic linker (most reliable method)
145- if [ -e /lib/ld-musl-x86_64.so.1 ] || [ -e /lib/ld-musl-aarch64.so.1 ]; then
146- echo " musl"
147- return
144+ # Prefer positive glibc detection first.
145+ # This avoids false musl detection on systems where musl is installed
146+ # but the distro itself is glibc-based (common on WSL/Ubuntu).
147+ if command -v getconf & > /dev/null; then
148+ if getconf GNU_LIBC_VERSION > /dev/null 2>&1 ; then
149+ echo " gnu"
150+ return
151+ fi
148152 fi
149153
150- # Check if ldd exists and is musl-based
154+ # Check ldd output for musl/glibc
151155 if command -v ldd & > /dev/null; then
152156 if ldd --version 2>&1 | grep -qi musl; then
153157 echo " musl"
154158 return
155159 fi
160+ if ldd --version 2>&1 | grep -qi ' gnu libc\|glibc' ; then
161+ echo " gnu"
162+ return
163+ fi
156164 fi
157165
158- # Default to gnu (glibc)
159- echo " gnu"
166+ # Final fallback: musl loader present usually indicates musl-based distro,
167+ # but only check this after glibc detection to avoid false positives.
168+ if [ -e /lib/ld-musl-x86_64.so.1 ] || [ -e /lib/ld-musl-aarch64.so.1 ]; then
169+ echo " musl"
170+ else
171+ echo " gnu"
172+ fi
160173}
161174
162175# Detect platform
You can’t perform that action at this time.
0 commit comments