From c869d35574f3db86960e833749eb8a134bb741a7 Mon Sep 17 00:00:00 2001 From: justdan6 Date: Fri, 28 Jul 2023 11:19:25 -0600 Subject: [PATCH 1/3] Check for linux/limits.h before including it --- Modules/posixmodule.c | 2 +- configure | 6 ++++++ configure.ac | 2 +- pyconfig.h.in | 3 +++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index bab2ac2ccf59f0..f77a3dfe1ccabe 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -285,7 +285,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(__linux__) && !defined(__FreeBSD_kernel__) && !defined(__GNU__) # define USE_XATTRS # include // Needed for XATTR_SIZE_MAX on musl libc. #endif diff --git a/configure b/configure index 18d404c8dc0605..80b4a001c6d6d7 100755 --- a/configure +++ b/configure @@ -10549,6 +10549,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 diff --git a/configure.ac b/configure.ac index cdb88a3071976c..8a84eaf6b370a1 100644 --- a/configure.ac +++ b/configure.ac @@ -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 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 \ diff --git a/pyconfig.h.in b/pyconfig.h.in index 0828dc8d4b58cd..dab8ebf64371f3 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -721,6 +721,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_FS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_LIMITS_H + /* Define to 1 if you have the header file. */ #undef HAVE_LINUX_MEMFD_H From 81ebcda98b9d52120b6f0b085e507526ac84b056 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 28 Jul 2023 18:17:34 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2023-07-28-18-17-33.gh-issue-106881.U3Ezdq.rst 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 00000000000000..40b2609e95c7e9 --- /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`. From b5220aab93ec9d36b78396a1df717f3539b0c30f Mon Sep 17 00:00:00 2001 From: justdan6 <134341009+justdan6@users.noreply.github.com> Date: Fri, 28 Jul 2023 14:34:45 -0600 Subject: [PATCH 3/3] Update Modules/posixmodule.c Co-authored-by: Erlend E. Aasland --- Modules/posixmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index f77a3dfe1ccabe..a42e41c081e5b7 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -285,7 +285,7 @@ corresponding Unix manual entries for more information on calls."); # undef HAVE_SCHED_SETAFFINITY #endif -#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LINUX_LIMITS_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 // Needed for XATTR_SIZE_MAX on musl libc. #endif