Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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

Description

@ahesford

Bug report

Bug description:

The functionplatform.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 calledmusl or a library calledlibc.musl with some arch-specific suffix. A glance at an Alpine container suggests thatlibc.musl*.so.* is just a symlink to the linker atld-musl-${arch}.so.${version}.

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

Expanding the second regex fromlibc.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 thelibc.musl alternative superfluous. However, as I don't use Alpine, I am not comfortable saying that simply replacinglibc.musl withld-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

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp