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

platform.libc_ver() fails to detect musl on Void Linux · Issue #141600 · python/cpython · GitHub

Repository navigation

platform.libc_ver() fails to detect musl on Void Linux #141600

Closed

Description

Bug report

Bug description:

The function platform.libc_ver tries to detect the C library against which an executable is linked (sys.executable, by default) by matching a number of patterns. For musl, this includes looking for strings matching one of the regexes (irrelevant groups omitted)

musl-[0-9.]+
libc.musl(-\w+)?.so(\.\d[0-9.]*)?

These target Alpine Linux, which apparently may link against a library just called musl or a library called libc.musl with some arch-specific suffix. A glance at an Alpine container suggests that libc.musl*.so.* is just a symlink to the linker at ld-musl-${arch}.so.${version}.

On Void Linux with musl, we do not make a libc.musl symlink. Instead, libc.so is the generic name for the musl C library on Void, and ld-musl-${arch}.so.${version} is a symlink to this library. Both musl regexes fail to match this structure, so Python reports libc rather than musl.

Expanding the second regex from libc.musl to (libc.|ld-)musl will fix this. As a bonus, this also seems to match expectations on Alpine, where it will pick up the linker name and render the libc.musl alternative superfluous. However, as I don't use Alpine, I am not comfortable saying that simply replacing libc.musl with ld-musl is sufficient.

NOTE: libc.musl in the regex seems to be a mistake in itself. The . ought to be escaped to match a literal . rather than any character.

CPython versions tested on:

3.14, CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Nov 15, 2025
  2. StanFromIreland commented on Nov 15, 2025

  3. added a commit that references this issue on Nov 22, 2025
  4. added a commit that references this issue on Nov 22, 2025
  5. zware commented on Nov 22, 2025

    Member

    Thanks for the report and patch!

  6. added a commit that references this issue on Nov 22, 2025
  7. added a commit that references this issue on Dec 6, 2025
  8. added a commit that references this issue on Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-unsupportedstdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL