Skip to content

gh-90548: Fix musl version detection with --strip-all #137864

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Aug 16, 2025

The change introduced in #131313 accidentally broke the musl version detection for test.support.linked_with_musl if cpython is compiled with --strip-all. In these cases the regex in platform.libc_ver should match the filename: libc.musl-x86_64.so.1.
https://pkgs.alpinelinux.org/contents?file=libc.*&path=&name=musl&branch=edge&repo=main&arch=

--strip-all is used among other things by the Alpine based Python docker image.
https://github.com/docker-library/python/blob/19c93d12094b07ecc21f67144a309c2fa0a10ef0/3.14-rc/alpine3.22/Dockerfile#L74

With this change:

./configure
make LDFLAGS="-Wl,--strip-all"

/usr/src # LD_LIBRARY_PATH=$PWD ./python.exe
Python 3.14.0rc2 (main, Aug 16 2025, 14:50:44) [GCC 14.2.0] on linux
>>> import test.support
>>> test.support.linked_to_musl()
(1,)

/usr/src # LD_LIBRARY_PATH=$PWD ./python.exe -m test.pythoninfo|grep libc
platform.libc_ver: musl 1

/CC @bitdancer

Copy link
Member

@AA-Turner AA-Turner left a comment

Choose a reason for hiding this comment

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

The added pattern seems ostensibly reasonable.

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
@cdce8p
Copy link
Contributor Author

cdce8p commented Aug 16, 2025

@AA-Turner I believe the OS-Linux label might be incorrect. Alpine is technically unsupported. Never the less, since #131313 was added in 3.14, I would still appreciate if it could be backported. Especially as it also indirectly fixes test.support.linked_with_musl and thus some of the test failures on Alpine linux.

@AA-Turner
Copy link
Member

I would still appreciate if it could be backported.

I already added the backport label. Anything else missing?

I believe the OS-Linux label might be incorrect. Alpine is technically unsupported.

Fair enough, though "linux" is sufficiently vague that I think it is probably fine. Ideally we'd have a "libc-musl" label, but given as you say Alpine is unsupported, it's too niche at present.

@cdce8p
Copy link
Contributor Author

cdce8p commented Aug 16, 2025

I would still appreciate if it could be backported.

I already added the backport label. Anything else missing?

No, all good. I just wasn't sure if a fix for an unsupported platform meant it couldn't be backported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants