FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-90548: Fix musl version detection with --strip-all by cdce8p · Pull Request #137864 · python/cpython · GitHub

/ cpython Public

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

Merged
vstinner merged 3 commits into
python:mainfrom
cdce8p:musl-libc_ver
Sep 1, 2025
Merged

gh-90548: Fix musl version detection with --strip-all#137864
vstinner merged 3 commits into
python:mainfrom
cdce8p:musl-libc_ver

Conversation

cdce8p commented Aug 16, 2025
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

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

AA-Turner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The added pattern seems ostensibly reasonable.

Comment thread Lib/platform.py Outdated
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Comment thread Lib/platform.py Outdated

cdce8p commented Aug 16, 2025

Copy link
Copy Markdown
Contributor Author

@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.

Copy link
Copy Markdown
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 commented Aug 16, 2025

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Member

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.

FWIW we have a "musl" section in the Unsupported platforms project.

cdce8p commented Aug 21, 2025

Copy link
Copy Markdown
Contributor Author

@vstinner Would you mind taking a look at this one? I believe you also reviewed the predecessor #131313.

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM

vstinner merged commit 6528cf4 into python:main Sep 1, 2025
48 checks passed

Copy link
Copy Markdown

Thanks @cdce8p for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 1, 2025
…-137864)

(cherry picked from commit 6528cf4)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>

bedevere-app Bot commented Sep 1, 2025

Copy link
Copy Markdown

GH-138348 is a backport of this pull request to the 3.14 branch.

bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Sep 1, 2025

vstinner commented Sep 1, 2025

Copy link
Copy Markdown
Member

Merged, thanks for the fix and added tests!

cdce8p deleted the musl-libc_ver branch September 1, 2025 17:22
hugovk pushed a commit that referenced this pull request Sep 7, 2025
…) (#138348)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
kumaraditya303 pushed a commit to miss-islington/cpython that referenced this pull request Sep 9, 2025
…ythonGH-137864) (python#138348)

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
lkollar pushed a commit to lkollar/cpython that referenced this pull request Sep 9, 2025
…37864)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL