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

gh-141600: fix musl detection on Void Linux by ahesford · Pull Request #141602 · python/cpython · GitHub

Repository navigation

gh-141600: fix musl detection on Void Linux - #141602

Merged
zware merged 1 commit into
python:mainfrom
ahesford:zuppa_di_pesce
Nov 22, 2025
Merged

zware merged 1 commit into
python:mainfrom
ahesford:zuppa_di_pesce

Conversation

ahesford commented Nov 15, 2025 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

This patch amends the search patterns in the function platform.libc_ver to properly recognize musl on Void Linux. Unlike Alpine, Void does not provide a libc.musl symlink that points to the linker, so executables link to a generic (and unversioned) libc.so, which is just a symlink to the linker at ld-musl-${arch}.so.${version}. By slightly modifying the pattern to accept ld-musl in addition to libc.musl, the function will pick up the linker encoded in executable rather than the generic C library path.

This patch also prevents a match against libc.so from setting the returned library name to libc when the library name has already been set to glibc or musl. Previously, the exclusion only applied when the library name was already set to glibc. This change is necessary because the pattern matching will pick up Void's generic libc.so after it has picked up the ld-linux linker path.

Finally, a unit test that relies (via the linked_to_musl function) on the version returned by libc_ver has been amended to accept a returned version consisting only of a single major number in addition to a complete full (major, minor, patch) triplet. The patterns admit the possibility that only the major version is known, so this must be accommodated.

python-cla-bot Bot commented Nov 15, 2025 •
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

zware commented Nov 17, 2025

Copy link
Copy Markdown
Member

!buildbot Alpine

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @zware for commit 87f95c1 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F141602%2Fmerge

The command will test the builders whose names match following regular expression: Alpine

The builders matched are:

  • AMD64 Alpine Linux PR
  • AMD64 Alpine Linux NoGIL PR

Comment thread Lib/platform.py Outdated
| (libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)
| (musl-([0-9.]+))
| (libc.musl(?:-\w+)?.so(?:\.(\d[0-9.]*))?)
| ((?:libc.|ld-)musl(?:-\w+)?.so(?:\.(\d[0-9.]*))?)

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

There is a bug in the existing regex, it should be libc\. instead of libc., no?

Suggested change
| ((?:libc.|ld-)musl(?:-\w+)?.so(?:\.(\d[0-9.]*))?)
| ((?:libc\.|ld-)musl(?:-\w+)?.so(?:\.(\d[0-9.]*))?)

Copy link
Copy Markdown
Contributor Author

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

I saw the bug and thought about fixing it, but then I wondered what esoteric musl-based distribution would break if the regex gets more specific. If this is not a concern, we can quote the dot.

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

If later we discover Linux distributions where musl is not properly detected, we can update the regex again. For now, I would prefer to use a strict libc\..

Copy link
Copy Markdown
Contributor Author

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

Done.

zware merged commit 08477db into python:main Nov 22, 2025
50 checks passed
zware added the needs backport to 3.14 bugs and security fixes label Nov 22, 2025

Copy link
Copy Markdown

Thanks @ahesford for the PR, and @zware 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 Nov 22, 2025
…41602)

(cherry picked from commit 08477db)

Co-authored-by: Andrew J. Hesford <ajh@sideband.org>

bedevere-app Bot commented Nov 22, 2025

Copy link
Copy Markdown

GH-141850 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 Nov 22, 2025
ahesford deleted the zuppa_di_pesce branch November 22, 2025 19:14
StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL