]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-106881: Check for linux/limits.h before including it (#107397) (#107414)
authorjustdan6 <134341009+justdan6@users.noreply.github.com>
Fri, 28 Jul 2023 23:29:31 +0000 (17:29 -0600)
committerGitHub <noreply@github.com>
Fri, 28 Jul 2023 23:29:31 +0000 (16:29 -0700)
* Check for linux/limits.h before including it

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

Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst [new file with mode: 0644]
Modules/posixmodule.c
configure
configure.ac
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 (file)
index 0000000..40b2609
--- /dev/null
@@ -0,0 +1 @@
+Check for `linux/limits.h` before including it in `Modules/posixmodule.c`.
index fde1e4f461bc9e68bc54e19b0bc138c3fa6bcbb2..342f393b1f0f9c7ce6ce6ea2e762a0b4ee1e9b5b 100644 (file)
@@ -286,7 +286,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
index 3806da7723fdaf9b24c1d1068f46ffb6c05cd11a..b6f90bcd8c7300cbbe0e2a653c9f39e605e8507f 100755 (executable)
--- a/configure
+++ b/configure
@@ -10580,6 +10580,12 @@ if test "x$ac_cv_header_linux_fs_h" = xyes
 then :
   printf "%s\n" "#define HAVE_LINUX_FS_H 1" >>confdefs.h
 
+fi
+ac_fn_c_check_header_compile "$LINENO" "linux/limits.h" "ac_cv_header_linux_limits_h" "$ac_includes_default"
+if test "x$ac_cv_header_linux_limits_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_LINUX_LIMITS_H 1" >>confdefs.h
+
 fi
 ac_fn_c_check_header_compile "$LINENO" "linux/memfd.h" "ac_cv_header_linux_memfd_h" "$ac_includes_default"
 if test "x$ac_cv_header_linux_memfd_h" = xyes
index 630db4bfbd53cc6bd39ac4a24f40747d37f699b7..ba768aea9307144c0ff3364f0889ad0c6e3b1563 100644 (file)
@@ -2848,7 +2848,7 @@ AC_DEFINE([STDC_HEADERS], [1],
 # 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/fs.h linux/memfd.h \
+  ieeefp.h io.h langinfo.h libintl.h libutil.h linux/auxvec.h sys/auxv.h linux/fs.h linux/limits.h linux/memfd.h \
   linux/random.h linux/soundcard.h \
   linux/tipc.h linux/wait.h netdb.h net/ethernet.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 \
index 7c87cd7d5ddd1f203a3ed22408ad5ee816929c7a..ada9dccfef10846e803cec0b2b7bfedbbdfe7cc5 100644 (file)
 /* Define to 1 if you have the <linux/fs.h> header file. */
 #undef HAVE_LINUX_FS_H
 
+/* 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