aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-02-14 07:21:58 +0000
committerMichał Górny <mgorny@gentoo.org>2023-02-14 15:42:08 +0100
commit4916b296289ff84eb155a8de05b43b7fc6deb87c (patch)
tree95c8c256af585016db39593848bb93f48b52b10d
parentSkip tests which interact with invalid UTF-8 files (diff)
downloadcpython-4916b296289ff84eb155a8de05b43b7fc6deb87c.tar.gz
cpython-4916b296289ff84eb155a8de05b43b7fc6deb87c.tar.bz2
cpython-4916b296289ff84eb155a8de05b43b7fc6deb87c.zip
gh-101857: Allow xattr detection on musl libc (#101858)gentoo-3.11.2_p1
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>
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2023-02-12-22-40-22.gh-issue-101857._bribG.rst1
-rw-r--r--Modules/posixmodule.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-02-12-22-40-22.gh-issue-101857._bribG.rst b/Misc/NEWS.d/next/Core and Builtins/2023-02-12-22-40-22.gh-issue-101857._bribG.rst
new file mode 100644
index 00000000000..832cc300fa9
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-02-12-22-40-22.gh-issue-101857._bribG.rst
@@ -0,0 +1 @@
+Fix xattr support detection on Linux systems by widening the check to linux, not just glibc. This fixes support for musl.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 150bb78cb41..c57a3b01ec9 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -272,8 +272,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