[Python-checkins] [3.11] gh-106881: Check for linux/limits.h before including it (#107397) (#107415)

gpshead webhook-mailer at python.org
Fri Jul 28 19:36:58 EDT 2023


https://github.com/python/cpython/commit/4049c5d6f85627f117e9be6a1729a17fce899645
commit: 4049c5d6f85627f117e9be6a1729a17fce899645
branch: 3.11
author: justdan6 <134341009+justdan6 at users.noreply.github.com>
committer: gpshead <greg at krypto.org>
date: 2023-07-28T23:36:54Z
summary:

[3.11] gh-106881: Check for linux/limits.h before including it (#107397) (#107415)

* [3.11] gh-106881: Check for linux/limits.h before including it (#107397)

* Check for linux/limits.h before including it

Co-authored-by: Erlend E. Aasland <erlend.aasland at protonmail.com>
(cherry picked from commit 11c055f5ff1a353de6d2e77f2af24aaa782878ba)

* Fix sphinx-lint error in NEWS entry

files:
A Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst
M Modules/posixmodule.c
M configure
M configure.ac
M pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst b/Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst
new file mode 100644
index 0000000000000..7febf99c48a79
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst
@@ -0,0 +1 @@
+Check for ``linux/limits.h`` before including it in ``Modules/posixmodule.c``.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index c000a32032287..9d4228896d230 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -280,7 +280,7 @@ corresponding Unix manual entries for more information on calls.");
 #  undef HAVE_SCHED_SETAFFINITY
 #endif
 
-#if defined(HAVE_SYS_XATTR_H) && defined(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
+#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LINUX_LIMITS_H) && !defined(__FreeBSD_kernel__) && !defined(__GNU__)
 #  define USE_XATTRS
 #  include <linux/limits.h>  // Needed for XATTR_SIZE_MAX on musl libc.
 #endif
diff --git a/configure b/configure
index d686e09d81c2d..af4a5bbfdfa1a 100755
--- a/configure
+++ b/configure
@@ -9191,7 +9191,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h
 # checks for header files
 for ac_header in  \
   alloca.h asm/types.h bluetooth.h conio.h crypt.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \
-  ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/memfd.h \
+  ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/limits.h linux/memfd.h \
   linux/random.h linux/soundcard.h \
   linux/tipc.h linux/wait.h netdb.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \
   sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
diff --git a/configure.ac b/configure.ac
index 35026f7a2369a..e1cbb7c7fbe9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2668,7 +2668,7 @@ AC_DEFINE(STDC_HEADERS, 1, [Define to 1 if you have the ANSI C header files.])
 # checks for header files
 AC_CHECK_HEADERS([ \
   alloca.h asm/types.h bluetooth.h conio.h crypt.h direct.h dlfcn.h endian.h errno.h fcntl.h grp.h \
-  ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/memfd.h \
+  ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/limits.h linux/memfd.h \
   linux/random.h linux/soundcard.h \
   linux/tipc.h linux/wait.h netdb.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \
   sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 75f1d90e9bd37..0536047f573ce 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -718,6 +718,9 @@
 /* Define if compiling using Linux 4.1 or later. */
 #undef HAVE_LINUX_CAN_RAW_JOIN_FILTERS
 
+/* Define to 1 if you have the <linux/limits.h> header file. */
+#undef HAVE_LINUX_LIMITS_H
+
 /* Define to 1 if you have the <linux/memfd.h> header file. */
 #undef HAVE_LINUX_MEMFD_H
 



More information about the Python-checkins mailing list