Skip to content

Commit 8be8101

Browse files
thesamesamgpshead
andauthored
pythongh-101857: Allow xattr detection on musl libc (python#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 Co-authored-by: Gregory P. Smith <[email protected]>
1 parent 928752c commit 8be8101

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix xattr support detection on Linux systems by widening the check to linux, not just glibc. This fixes support for musl.

Modules/posixmodule.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,9 @@ corresponding Unix manual entries for more information on calls.");
274274
# undef HAVE_SCHED_SETAFFINITY
275275
#endif
276276

277-
#if defined(HAVE_SYS_XATTR_H) && defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
277+
#if defined(HAVE_SYS_XATTR_H) && defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
278278
# define USE_XATTRS
279+
# include <linux/limits.h> // Needed for XATTR_SIZE_MAX on musl libc.
279280
#endif
280281

281282
#ifdef USE_XATTRS

0 commit comments

Comments
 (0)