Skip to content

platform.libc_ver() returns no information on Alpine Linux #87414

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
thedrow mannequin opened this issue Feb 18, 2021 · 5 comments
Open

platform.libc_ver() returns no information on Alpine Linux #87414

thedrow mannequin opened this issue Feb 18, 2021 · 5 comments
Labels
3.8 (EOL) end of life OS-unsupported stdlib Python modules in the Lib dir

Comments

@thedrow
Copy link
Mannequin

thedrow mannequin commented Feb 18, 2021

BPO 43248
Nosy @The-Compiler, @thedrow, @corona10

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-02-18.11:13:38.696>
labels = ['3.8']
title = 'platform.libc_ver() returns no information on Alpine Linux'
updated_at = <Date 2021-07-05.08:01:18.532>
user = 'https://github.com/thedrow'

bugs.python.org fields:

activity = <Date 2021-07-05.08:01:18.532>
actor = 'The Compiler'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-02-18.11:13:38.696>
creator = 'Omer.Katz'
dependencies = []
files = []
hgrepos = []
issue_num = 43248
keywords = []
message_count = 2.0
messages = ['387211', '387396']
nosy_count = 3.0
nosy_names = ['The Compiler', 'Omer.Katz', 'corona10']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue43248'
versions = ['Python 3.8']

Linked PRs

@thedrow
Copy link
Mannequin Author

thedrow mannequin commented Feb 18, 2021

When calling platform.libc_ver() on Alpine I get the following tuple: ('', '')

Instead, I expect to get ('muslc', '<version number>') or an exception if the libc type & version cannot be detected.
If one of them is not detected, the returned value shouldn't be an empty string but None.
The current API is not what most people would expect it to be.
This is verified on Python 3.8 since that's the latest one available on Alpine.

This code reliably detects musl libc and its version: https://github.com/lovell/detect-libc/blob/master/lib/detect-libc.js

I'd be happy to contribute a PR if needed.

@thedrow thedrow mannequin added the 3.8 (EOL) end of life label Feb 18, 2021
@corona10
Copy link
Member

@Omer.Katz

This issue should be fixed, feel free to submit the PR

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@mara004
Copy link
Contributor

mara004 commented Apr 30, 2022

Any progress on this? Is there any other function to check whether the host system is using musl or glibc?

mara004 added a commit to pypdfium2-team/pypdfium2 that referenced this issue Apr 30, 2022
Looks like platform.libc_ver()[0] currently just returns an empty string
on musl: python/cpython#87414
@mara004
Copy link
Contributor

mara004 commented Jan 19, 2023

How about just integrating packaging's musl detection code into the standard library?
https://github.com/pypa/packaging/blob/main/src/packaging/_musllinux.py

(Actually, I'm a bit surprised this wasn't done directly on the implementation of PEP 656.)

@iritkatriel iritkatriel added the stdlib Python modules in the Lib dir label Dec 1, 2023
jollaitbot pushed a commit to sailfishos-mirror/m2crypto that referenced this issue Oct 30, 2024
It is tempting to use it incorrectly, and implementation is
horrible and based on unresolved bug in CPython (or musl libc itself).

References: python/cpython#87414
jollaitbot pushed a commit to sailfishos-mirror/m2crypto that referenced this issue Apr 15, 2025
It is tempting to use it incorrectly, and implementation is
horrible and based on unresolved bug in CPython (or musl libc itself).

References: python/cpython#87414
@zware
Copy link
Member

zware commented Apr 28, 2025

Strictly speaking, this issue has been fixed by GH-131313. However, GH-103784 is still open which may or may not improve on the situation, and the commit message from GH-131313 mentions that WASI/Emscripten support is still lacking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.8 (EOL) end of life OS-unsupported stdlib Python modules in the Lib dir
Projects
Status: No status
Development

No branches or pull requests

5 participants