python36: Fix PR pkg/53229 (closing stdin leads to EBADF) Also NetBSD seems affected by bpo-30225, address that using fstat(2) on NetBSD too. Reported upstream via bpo-33384: Index: distinfo =================================================================== RCS file: /cvsroot/pkgsrc/lang/python36/distinfo,v retrieving revision 1.18 diff -u -p -r1.18 distinfo --- distinfo 29 Mar 2018 15:28:16 -0000 1.18 +++ distinfo 19 May 2018 15:08:08 -0000 @@ -13,6 +13,7 @@ SHA1 (patch-Modules_makesetup) = a06786e SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d SHA1 (patch-Modules_socketmodule.c) = e6bdb8990cd9b8cf0b0ff48e6ae7b664681a9924 SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c +SHA1 (patch-Python_pylifecycle.c) = 7b0da511690abd11876f42da3fd3ac6ffc16efbf SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be SHA1 (patch-configure) = d999d63bd437500a3a8f176fcd5aa3c48ded836e SHA1 (patch-pyconfig.h.in) = 58e2c03489f9b6e4d88f144d8c09773f92eacd61 Index: patches/patch-Python_pylifecycle.c =================================================================== RCS file: patches/patch-Python_pylifecycle.c diff -N patches/patch-Python_pylifecycle.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Python_pylifecycle.c 19 May 2018 15:08:08 -0000 @@ -0,0 +1,15 @@ +$NetBSD$ + +Also NetBSD is affected by bpo-30225, use fstat(2) on NetBSD too. + +--- Python/pylifecycle.c.orig 2018-03-28 09:19:31.000000000 +0000 ++++ Python/pylifecycle.c +@@ -1040,7 +1040,7 @@ initsite(void) + static int + is_valid_fd(int fd) + { +-#ifdef __APPLE__ ++#if defined(__APPLE__) || defined(__NetBSD__) + /* bpo-30225: On macOS Tiger, when stdout is redirected to a pipe + and the other side of the pipe is closed, dup(1) succeed, whereas + fstat(1, &st) fails with EBADF. Prefer fstat() over dup() to detect