From 992002afdfa003225305c38eac0b5b33dd32d7d8 Mon Sep 17 00:00:00 2001 From: Jakub Kulik Date: Fri, 21 Dec 2018 10:08:54 +0000 Subject: [PATCH 1/3] bpo-35550 fix incorrect Solaris define guards --- Modules/_posixsubprocess.c | 2 +- Modules/posixmodule.c | 2 +- Modules/socketmodule.c | 2 +- Modules/timemodule.c | 4 ++-- Python/bootstrap_hash.c | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Modules/_posixsubprocess.c b/Modules/_posixsubprocess.c index 2b2c57d0418545..81a23c6d330037 100644 --- a/Modules/_posixsubprocess.c +++ b/Modules/_posixsubprocess.c @@ -30,7 +30,7 @@ # define SYS_getdents64 __NR_getdents64 #endif -#if defined(sun) +#if defined(__sun) && defined(__SVR4) /* readdir64 is used to work around Solaris 9 bug 6395699. */ # define readdir readdir64 # define dirent dirent64 diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index d05724a50d1c4c..aa90dd5812671e 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6334,7 +6334,7 @@ os_openpty_impl(PyObject *module) #endif #if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) PyOS_sighandler_t sig_saved; -#ifdef sun +#ifdef defined(__sun) && defined(__SVR4) extern char *ptsname(int fildes); #endif #endif diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 73d3e1add3ef62..43d1cb3023ad51 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -263,7 +263,7 @@ if_indextoname(index) -- return the corresponding interface name\n\ #endif /* Solaris fails to define this variable at all. */ -#if defined(sun) && !defined(INET_ADDRSTRLEN) +#if (defined(__sun) && defined(__SVR4)) && !defined(INET_ADDRSTRLEN) #define INET_ADDRSTRLEN 16 #endif diff --git a/Modules/timemodule.c b/Modules/timemodule.c index 01bb430ece6043..9966bf52b01f3c 100644 --- a/Modules/timemodule.c +++ b/Modules/timemodule.c @@ -743,7 +743,7 @@ time_strftime(PyObject *self, PyObject *args) return NULL; } -#if defined(_MSC_VER) || defined(sun) || defined(_AIX) +#if defined(_MSC_VER) || (defined(__sun) && defined(__SVR4)) || defined(_AIX) if (buf.tm_year + 1900 < 1 || 9999 < buf.tm_year + 1900) { PyErr_SetString(PyExc_ValueError, "strftime() requires year in [1; 9999]"); @@ -789,7 +789,7 @@ time_strftime(PyObject *self, PyObject *args) return NULL; } } -#elif (defined(_AIX) || defined(sun)) && defined(HAVE_WCSFTIME) +#elif (defined(_AIX) || (defined(__sun) && defined(__SVR4))) && defined(HAVE_WCSFTIME) for (outbuf = wcschr(fmt, '%'); outbuf != NULL; outbuf = wcschr(outbuf+2, '%')) diff --git a/Python/bootstrap_hash.c b/Python/bootstrap_hash.c index eb848c8ff6e365..35d9b7f24a912f 100644 --- a/Python/bootstrap_hash.c +++ b/Python/bootstrap_hash.c @@ -114,7 +114,7 @@ py_getrandom(void *buffer, Py_ssize_t size, int blocking, int raise) flags = blocking ? 0 : GRND_NONBLOCK; dest = buffer; while (0 < size) { -#ifdef sun +#if defined(__sun) && defined(__SVR4) /* Issue #26735: On Solaris, getrandom() is limited to returning up to 1024 bytes. Call it multiple times if more bytes are requested. */ @@ -264,7 +264,7 @@ py_getentropy(char *buffer, Py_ssize_t size, int raise) } return 1; } -#endif /* defined(HAVE_GETENTROPY) && !defined(sun) */ +#endif /* defined(HAVE_GETENTROPY) && !(defined(__sun) && defined(__SVR4)) */ static struct { From b586a86839bcdd64e796e8ffacb040cb361ebd8c Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" Date: Sat, 29 Dec 2018 10:19:44 +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 --- Misc/NEWS.d/next/Build/2018-12-29-10-19-43.bpo-35550.BTuu8e.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Build/2018-12-29-10-19-43.bpo-35550.BTuu8e.rst diff --git a/Misc/NEWS.d/next/Build/2018-12-29-10-19-43.bpo-35550.BTuu8e.rst b/Misc/NEWS.d/next/Build/2018-12-29-10-19-43.bpo-35550.BTuu8e.rst new file mode 100644 index 00000000000000..8a6b90d5970eb1 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2018-12-29-10-19-43.bpo-35550.BTuu8e.rst @@ -0,0 +1 @@ +Fix incorrect Solaris #ifdef checks to look for __sun && __SVR4 instead of sun when compiling. \ No newline at end of file From 59c7e38a6c99017cb20cb768cd1989c2a7596909 Mon Sep 17 00:00:00 2001 From: Jakub Kulik Date: Sat, 29 Dec 2018 11:26:57 +0100 Subject: [PATCH 3/3] Fix minor ifdef mistake --- Modules/posixmodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index aa90dd5812671e..302eb8254b930a 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -6334,7 +6334,7 @@ os_openpty_impl(PyObject *module) #endif #if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) PyOS_sighandler_t sig_saved; -#ifdef defined(__sun) && defined(__SVR4) +#if defined(__sun) && defined(__SVR4) extern char *ptsname(int fildes); #endif #endif