Skip to content

Commit

Permalink
pythongh-101857: Allow xattr detection on musl libc (python#101858)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
thesamesam and gpshead authored Feb 14, 2023
1 parent 928752c commit 8be8101
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix xattr support detection on Linux systems by widening the check to linux, not just glibc. This fixes support for musl.
3 changes: 2 additions & 1 deletion Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,9 @@ corresponding Unix manual entries for more information on calls.");
# undef HAVE_SCHED_SETAFFINITY
#endif

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

#ifdef USE_XATTRS
Expand Down

0 comments on commit 8be8101

Please sign in to comment.