Skip to content
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

posixmodule.c doesn't detect xattr support on Linux with non-glibc (e.g. musl) #101857

Closed
thesamesam opened this issue Feb 12, 2023 · 0 comments
Closed
Assignees
Labels
build The build process and cross-build extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error

Comments

@thesamesam
Copy link
Contributor

thesamesam commented Feb 12, 2023

Bug report

posixmodule.c detects xattr support by checking for __GLIBC__ (and some other conditions) at

#if defined(HAVE_SYS_XATTR_H) && defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
. This incorrectly excludes the musl libc,which supports xattr functionality.

On a musl system, it's easy to reproduce with:

>>> import os
>>> os.listxattr 
Traceback (most recent call last): 
	File "", line 1, in
AttributeError: module 'os' has no attribute 'listxattr'

Your environment

Linked PRs

@thesamesam thesamesam added the type-bug An unexpected behavior, bug, or error label Feb 12, 2023
thesamesam added a commit to thesamesam/cpython that referenced this issue Feb 12, 2023
Previously, we checked exclusively for __GLIBC__ (AND'd with some other
conditions). Checking for __linux__ instead should be fine.

This fixes using e.g. os.listxattr() on systems using musl libc.

Bug: https://bugs.gentoo.org/894130
@arhadthedev arhadthedev added the extension-modules C modules in the Modules dir label Feb 13, 2023
gpshead added a commit that referenced this issue Feb 14, 2023
Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 14, 2023
Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

(cherry picked from commit 8be8101)

Co-authored-by: Sam James <sam@gentoo.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
@gpshead gpshead added the build The build process and cross-build label Feb 14, 2023
@gpshead gpshead self-assigned this Feb 14, 2023
@gpshead gpshead closed this as completed Feb 14, 2023
gpshead added a commit that referenced this issue May 21, 2023
…1894)

gh-101857: Allow xattr detection on musl libc (GH-101858)

Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

(cherry picked from commit 8be8101)

Co-authored-by: Sam James <sam@gentoo.org>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
gentoo-bot pushed a commit to gentoo/cpython that referenced this issue May 21, 2024
Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gentoo-bot pushed a commit to gentoo/cpython that referenced this issue May 21, 2024
Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gentoo-bot pushed a commit to gentoo/cpython that referenced this issue Sep 19, 2024
Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

Co-authored-by: Gregory P. Smith <greg@krypto.org>
gentoo-bot pushed a commit to gentoo/cpython that referenced this issue Sep 19, 2024
Previously, we checked exclusively for `__GLIBC__` (AND'd with some other
conditions). Checking for `__linux__` instead should be fine.

This fixes using e.g. `os.listxattr()` on systems using musl libc.

Bug: https://bugs.gentoo.org/894130

Co-authored-by: Gregory P. Smith <greg@krypto.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build extension-modules C modules in the Modules dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants