From 67088cfdd5c0120421a25a582b273d3a36c11e13 Mon Sep 17 00:00:00 2001 From: Charalampos Stratakis Date: Tue, 23 Jan 2018 15:34:15 +0100 Subject: [PATCH] bpo-32635: Fix a segfault when importing the crypt module with libxcrypt. glibc is deprecating libcrypt in favor of libxcrypt, however python assumes that crypt.h will always be included. This change makes the header inclusion explicit when libxcrypt is present on the system. --- Include/Python.h | 3 +++ .../NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst | 2 ++ configure | 2 +- configure.ac | 2 +- pyconfig.h.in | 3 +++ 5 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst diff --git a/Include/Python.h b/Include/Python.h index dd595ea5e4ca54..1feb1531cc94f0 100644 --- a/Include/Python.h +++ b/Include/Python.h @@ -35,6 +35,9 @@ #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_CRYPT_H +#include +#endif /* For size_t? */ #ifdef HAVE_STDDEF_H diff --git a/Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst b/Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst new file mode 100644 index 00000000000000..d411890f5d884e --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-01-23-15-33-40.bpo-32635.qHwIZy.rst @@ -0,0 +1,2 @@ +Fix segfault of the crypt module when libxcrypt is provided instead of +libcrypt at the system. diff --git a/configure b/configure index a9b0ab9646bed0..5904b54c3eda80 100755 --- a/configure +++ b/configure @@ -7682,7 +7682,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi -for ac_header in asm/types.h conio.h direct.h dlfcn.h errno.h \ +for ac_header in asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \ sched.h shadow.h signal.h stropts.h termios.h \ diff --git a/configure.ac b/configure.ac index 03b0f501affa70..15ef872a53af45 100644 --- a/configure.ac +++ b/configure.ac @@ -2041,7 +2041,7 @@ dnl AC_MSG_RESULT($cpp_type) # checks for header files AC_HEADER_STDC -AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \ +AC_CHECK_HEADERS(asm/types.h crypt.h conio.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \ sched.h shadow.h signal.h stropts.h termios.h \ diff --git a/pyconfig.h.in b/pyconfig.h.in index dd7c62bad1bacb..fd5a0c38d89e44 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -140,6 +140,9 @@ /* Define to 1 if you have the `copysign' function. */ #undef HAVE_COPYSIGN +/* Define to 1 if you have the header file. */ +#undef HAVE_CRYPT_H + /* Define to 1 if you have the `ctermid' function. */ #undef HAVE_CTERMID