NetBSD Problem Report #53229

From martin@aprisoft.de  Sun Apr 29 08:28:40 2018
Return-Path: <martin@aprisoft.de>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 1923B7A261
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 29 Apr 2018 08:28:40 +0000 (UTC)
Message-Id: <20180429082827.679305CC850@emmas.aprisoft.de>
Date: Sun, 29 Apr 2018 10:28:27 +0200 (CEST)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: textproc/py-expat does not build w/o terminal session
X-Send-Pr-Version: 3.95

>Number:         53229
>Category:       pkg
>Synopsis:       textproc/py-expat does not build w/o terminal session
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    leot
>State:          feedback
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 29 08:30:00 +0000 2018
>Closed-Date:    
>Last-Modified:  Sun Jun 03 20:11:21 +0000 2018
>Originator:     Martin Husemann
>Release:        NetBSD 8.99.14
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD seven-days-to-the-wolves.aprisoft.de 8.99.14 NetBSD 8.99.14 (GENERIC) #213: Sat Apr 28 09:26:35 CEST 2018 martin@seven-days-to-the-wolves.aprisoft.de:/work/src/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:

Trying to build textproc/py-expat w/o a terminal session failse.

Doing it in a regular shell works fine:

=> Bootstrap dependency digest>=20010302: found digest-20160304
WARNING: [license.mk] Every package should define a LICENSE.
===> Skipping vulnerability checks.
WARNING: No /var/db/pkg/pkg-vulnerabilities file found.
WARNING: To fix run: `/usr/sbin/pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities'.
===> Building for py36-expat-3.6.5
(cd /work/pkgobj/textproc/py-expat/work/Python-3.6.5/ && /usr/bin/env USETOOLS=no PTHREAD_CFLAGS=\ -pthread\  PTHREAD_LDFLAGS=\ -pthread PTHREAD_LIBS= PTHREADBASE=/usr DL_CFLAGS=\ -pthread\  DL_LDFLAGS=\ -pthread DL_LIBS= PYTHON=/usr/pkg/bin/python3.6 CC=gcc CFLAGS=-O2\ -pipe\ -D_FORTIFY_SOURCE=2\ -I/usr/include\ -I/usr/pkg/include/python3.6 CPPFLAGS=-I/usr/include\ -I/usr/pkg/include/python3.6 CXX=c++ CXXFLAGS=-O2\ -pipe\ -D_FORTIFY_SOURCE=2\ -I/usr/include\ -I/usr/pkg/include/python3.6 COMPILER_RPATH_FLAG=-Wl,-R F77=g77 FC=g77 FFLAGS=-O LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C LC_MESSAGES=C LC_MONETARY=C LC_NUMERIC=C LC_TIME=C LDFLAGS=-L/usr/lib\ -Wl,-R/usr/lib\ -Wl,-R/usr/pkg/lib LINKER_RPATH_FLAG=-R PATH=/work/pkgobj/textproc/py-expat/work/.cwrapper/bin:/work/pkgobj/textproc/py-expat/work/.buildlink/bin:/work/pkgobj/textproc/py-expat/work/.gcc/bin:/work/pkgobj/textproc/py-expat/work/.tools/bin:/usr/pkg/bin:/root/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/X11
 R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/pkg/bin:/usr/X11R7/bin PREFIX=/usr/pkg MAKELEVEL=0 CONFIG_SITE= PKG_SYSCONFDIR=/usr/pkg/etc CXXCPP=cpp HOME=/work/pkgobj/textproc/py-expat/work/.home CWRAPPERS_CONFIG_DIR=/work/pkgobj/textproc/py-expat/work/.cwrapper/config CPP=cpp LOCALBASE=/usr/pkg X11BASE=/usr/X11R7 PKGMANDIR=man PKGINFODIR=info PKGGNUDIR=gnu/ MAKECONF=/dev/null OBJECT_FMT=ELF USETOOLS=no BSD_INSTALL_PROGRAM=/usr/bin/install\ -c\ -s\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_SCRIPT=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_LIB=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_DATA=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 644 BSD_INSTALL_MAN=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 644 BSD_INSTALL=/usr/bin/install BSD_INSTALL_PROGRAM_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_SCRIPT_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_LIB_DIR=/usr/bin/install\ -d\ -o\ root\ -
 g\ wheel\ -m\ 755 BSD_INSTALL_DATA_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_MAN_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_GAME=/usr/bin/install\ -c\ -s\ -o\ root\ -g\ wheel\ -m\ 2555 BSD_INSTALL_GAME_DATA=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 664 BSD_INSTALL_GAME_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 775 INSTALL_INFO= MAKEINFO=/work/pkgobj/textproc/py-expat/work/.tools/bin/makeinfo FLEX= BISON= PKG_CONFIG= PKG_CONFIG_LIBDIR=/work/pkgobj/textproc/py-expat/work/.buildlink/lib/pkgconfig:/work/pkgobj/textproc/py-expat/work/.buildlink/share/pkgconfig PKG_CONFIG_LOG=/work/pkgobj/textproc/py-expat/work/.pkg-config.log PKG_CONFIG_PATH= CWRAPPERS_CONFIG_DIR=/work/pkgobj/textproc/py-expat/work/.cwrapper/config /usr/pkg/bin/python3.6  setup.py  build )
running build
running build_ext
building 'pyexpat' extension
creating build
creating build/temp.netbsd-8.99.14-amd64-3.6
creating build/temp.netbsd-8.99.14-amd64-3.6/Modules
gcc -DNDEBUG -O2 -pipe -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include -O2 -pipe -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include/python3.6 -I/usr/include -I/usr/pkg/include/python3.6 -fPIC -DHAVE_EXPAT_H -I/work/pkgobj/textproc/py-expat/work/.buildlink/include -I/usr/pkg/include/python3.6 -c Modules/pyexpat.c -o build/temp.netbsd-8.99.14-amd64-3.6/Modules/pyexpat.o
creating build/lib.netbsd-8.99.14-amd64-3.6
gcc -pthread -shared -L. -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/lib -Wl,-R/usr/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -O2 -pipe -D_FORTIFY_SOURCE=2 -I/usr/include -I/usr/pkg/include/python3.6 -I/usr/include -I/usr/pkg/include/python3.6 build/temp.netbsd-8.99.14-amd64-3.6/Modules/pyexpat.o -L/work/pkgobj/textproc/py-expat/work/.buildlink/lib -L/usr/pkg/lib -Wl,-R/work/pkgobj/textproc/py-expat/work/.buildlink/lib -lexpat -lpython3.6 -o build/lib.netbsd-8.99.14-amd64-3.6/pyexpat.so



But if you start a background job to build it and disconnect from the
terminal, it fails:

Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x000075b4e4cee800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x00007b9cf4e33800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x0000718542489800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
=> Bootstrap dependency digest>=20010302: found digest-20160304
WARNING: [license.mk] Every package should define a LICENSE.
===> Skipping vulnerability checks.
WARNING: No /var/db/pkg/pkg-vulnerabilities file found.
WARNING: To fix run: `/usr/sbin/pkg_admin -K /var/db/pkg fetch-pkg-vulnerabilities'.
=> Checksum SHA1 OK for Python-3.6.5.tar.xz
=> Checksum RMD160 OK for Python-3.6.5.tar.xz
=> Checksum SHA512 OK for Python-3.6.5.tar.xz
===> Installing dependencies for py36-expat-3.6.5
==========================================================================
The following variables will affect the build process of this package,
py36-expat-3.6.5.  Their current value is shown below:

        * PYTHON_VERSION_DEFAULT = 36

Based on these variables, the following variables have been set:

        * PYPACKAGE = python36

You may want to abort the process now with CTRL-C and change their value
before continuing.  Be sure to run `/usr/bin/make clean' after
the changes.
==========================================================================
=> Tool dependency checkperms>=1.1: found checkperms-1.12
=> Build dependency cwrappers>=20150314: found cwrappers-20180325
=> Full dependency python36>=3.6.0: found python36-3.6.5
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x00007672eac21800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x00007b4597990800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x000077e9ca073800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
===> Overriding tools for py36-expat-3.6.5
===> Extracting for py36-expat-3.6.5
/usr/bin/sed  -e s!@EXPATPREFIX@!/work/pkgobj/textproc/py-expat/work/.buildlink!g  -e s!@EXPATRTPREFIX@!/usr!g  </usr/pkgsrc/textproc/py-expat/files/setup.py >/work/pkgobj/textproc/py-expat/work/Python-3.6.5/setup.py
===> Patching for py36-expat-3.6.5
(cd /work/pkgobj/textproc/py-expat/work/Python-3.6.5;  for f in /usr/pkgsrc/textproc/py-expat/../../lang/python36/patches/patch-*;do  /usr/bin/patch --batch <$f || true;  done)
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Lib_distutils_command_install.py,v 1.1 2017/01/01 14:34:27 adam Exp $
|
|--- Lib/distutils/command/install.py.orig	2016-12-23 02:21:19.000000000 +0000
|+++ Lib/distutils/command/install.py
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 652.
1 out of 1 hunks ignored--saving rejects to install.py.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Lib_distutils_sysconfig.py,v 1.2 2017/01/26 09:13:27 adam Exp $
|
|Remove _multiarch from config path (differs across platforms).
|Simplify _sysconfigdata to include only platform name.
|
|--- Lib/distutils/sysconfig.py.orig	2016-12-23 02:21:19.000000000 +0000
|+++ Lib/distutils/sysconfig.py
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 242.
Hunk #2 ignored at 417.
2 out of 2 hunks ignored--saving rejects to sysconfig.py.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Lib_distutils_unixccompiler.py,v 1.1 2017/01/01 14:34:27 adam Exp $
|
|Do not force RUNPATH vs RPATH, trust the compiler to know what the
|platform wants.
|
|--- Lib/distutils/unixccompiler.py.orig	2016-12-23 02:21:19.000000000 +0000
|+++ Lib/distutils/unixccompiler.py
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 236.
1 out of 1 hunks ignored--saving rejects to unixccompiler.py.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Lib_sysconfig.py,v 1.2 2017/01/26 09:13:27 adam Exp $
|
|Remove _multiarch from config path (differs across platforms).
|Simplify _sysconfigdata to include only platform name.
|
|--- Lib/sysconfig.py.orig	2016-12-23 02:21:19.000000000 +0000
|+++ Lib/sysconfig.py
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 337.
1 out of 1 hunks ignored--saving rejects to sysconfig.py.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Makefile.pre.in,v 1.5 2017/12/19 09:37:14 adam Exp $
|
|Use only one optimisation level; needed for PLIST and setuptools compatibility.
|Do not build/install libpython3.so.
|Simplify _sysconfigdata to include only platform name.
|Swap targets libinstall and libainstall, to byte-compile python-config.py.
|
|--- Makefile.pre.in.orig	2017-12-19 04:53:56.000000000 +0000
|+++ Makefile.pre.in
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 96.
Hunk #2 ignored at 207.
Hunk #3 ignored at 432.
Hunk #4 ignored at 886.
Hunk #5 ignored at 894.
Hunk #6 ignored at 1101.
Hunk #7 ignored at 1160.
Hunk #8 ignored at 1338.
Hunk #9 ignored at 1356.
Hunk #10 ignored at 1364.
Hunk #11 ignored at 1464.
11 out of 11 hunks ignored--saving rejects to Makefile.pre.in.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Modules_makesetup,v 1.1 2017/01/01 14:34:27 adam Exp $
|
|Support -pthread compiler flag.
|http://bugs.python.org/issue21461
|
|--- Modules/makesetup.orig	2008-06-11 05:26:20.000000000 +0000
|+++ Modules/makesetup
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 166.
1 out of 1 hunks ignored--saving rejects to Modules/makesetup.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Modules_nismodule.c,v 1.1 2017/01/01 14:34:27 adam Exp $
|
|DragonFlyBSD support
|http://bugs.python.org/issue21459
|
|--- Modules/nismodule.c.orig	2010-08-19 09:03:03.000000000 +0000
|+++ Modules/nismodule.c
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 85.
1 out of 1 hunks ignored--saving rejects to Modules/nismodule.c.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Modules_socketmodule.c,v 1.2 2017/12/19 09:37:14 adam Exp $
|
|Support NetBSD's socketcan implementation
|
|--- Modules/socketmodule.c.orig	2017-12-19 04:53:56.000000000 +0000
|+++ Modules/socketmodule.c
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 1375.
Hunk #2 ignored at 1883.
Hunk #3 ignored at 1910.
Hunk #4 ignored at 7123.
4 out of 4 hunks ignored--saving rejects to Modules/socketmodule.c.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Modules_socketmodule.h,v 1.1 2017/05/30 13:36:39 bouyer Exp $
|
|--- Modules/socketmodule.h.orig	2017-03-21 07:32:38.000000000 +0100
|+++ Modules/socketmodule.h	2017-05-30 12:36:59.254776235 +0200
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 91.
1 out of 1 hunks ignored--saving rejects to Modules/socketmodule.h.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-Python_thread__pthread.h,v 1.1 2017/01/01 14:34:27 adam Exp $
|
|--- Python/thread_pthread.h.orig	2013-05-15 16:33:00.000000000 +0000
|+++ Python/thread_pthread.h
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 50.
1 out of 1 hunks ignored--saving rejects to thread_pthread.h.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-configure,v 1.10 2017/07/18 13:43:40 adam Exp $
|
|Simplify _sysconfigdata to include only platform name.
|
|MirBSD support
|http://bugs.python.org/issue21458
|
|Changes for consistency across pkgsrc platforms.
|
|Fix linking on Darwin.
|
|Use gnu99 instead of c99 to avoid "alloca() undefined" problems on macppc.
|
|detect netcan/can.h on NetBSD
|
|--- configure.orig	2017-07-08 03:33:27.000000000 +0000
|+++ configure
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 2925.
Hunk #2 ignored at 3317.
Hunk #3 ignored at 5962.
Hunk #4 ignored at 6937.
Hunk #5 ignored at 8112.
Hunk #6 ignored at 9228.
Hunk #7 ignored at 9253.
Hunk #8 ignored at 9294.
Hunk #9 ignored at 9341.
Hunk #10 ignored at 9391.
Hunk #11 ignored at 11168.
Hunk #12 ignored at 14995.
Hunk #13 ignored at 15006.
13 out of 13 hunks ignored--saving rejects to configure.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-pyconfig.h.in,v 1.1 2017/05/30 13:36:39 bouyer Exp $
|
|detect netcan/can.h on NetBSD
|
|--- pyconfig.h.in.orig	2017-05-30 12:31:24.586818399 +0200
|+++ pyconfig.h.in	2017-05-30 12:32:29.367288479 +0200
--------------------------
No file to patch.  Skipping...
Hunk #1 ignored at 565.
1 out of 1 hunks ignored--saving rejects to pyconfig.h.in.rej
done
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|$NetBSD: patch-setup.py,v 1.4 2017/12/19 09:37:14 adam Exp $
|
|Disable modules, so they can be built as separate packages.
|
|--- setup.py.orig	2017-12-19 04:53:56.000000000 +0000
|+++ setup.py
--------------------------
Patching file setup.py using Plan A...
Hunk #1 failed at 8.
No such line 42 in input file, ignoring
Hunk #2 failed at 44.
Hunk #3 failed at 514.
Hunk #4 failed at 844.
Hunk #5 failed at 855.
Hunk #6 failed at 874.
Hunk #7 failed at 1274.
Hunk #8 failed at 1309.
Hunk #9 failed at 2128.
Hunk #10 failed at 2365.
10 out of 10 hunks failed--saving rejects to setup.py.rej
done
===> Creating toolchain wrappers for py36-expat-3.6.5
===> Configuring for py36-expat-3.6.5
=> Checking for portability problems in extracted files
===> Building for py36-expat-3.6.5
(cd /work/pkgobj/textproc/py-expat/work/Python-3.6.5/ && /usr/bin/env USETOOLS=no PTHREAD_CFLAGS=\ -pthread\  PTHREAD_LDFLAGS=\ -pthread PTHREAD_LIBS= PTHREADBASE=/usr DL_CFLAGS=\ -pthread\  DL_LDFLAGS=\ -pthread DL_LIBS= PYTHON=/usr/pkg/bin/python3.6 CC=gcc CFLAGS=-O2\ -pipe\ -D_FORTIFY_SOURCE=2\ -I/usr/include\ -I/usr/pkg/include/python3.6 CPPFLAGS=-I/usr/include\ -I/usr/pkg/include/python3.6 CXX=c++ CXXFLAGS=-O2\ -pipe\ -D_FORTIFY_SOURCE=2\ -I/usr/include\ -I/usr/pkg/include/python3.6 COMPILER_RPATH_FLAG=-Wl,-R F77=g77 FC=g77 FFLAGS=-O LANG=C LC_ALL=C LC_COLLATE=C LC_CTYPE=C LC_MESSAGES=C LC_MONETARY=C LC_NUMERIC=C LC_TIME=C LDFLAGS=-L/usr/lib\ -Wl,-R/usr/lib\ -Wl,-R/usr/pkg/lib LINKER_RPATH_FLAG=-R PATH=/work/pkgobj/textproc/py-expat/work/.cwrapper/bin:/work/pkgobj/textproc/py-expat/work/.buildlink/bin:/work/pkgobj/textproc/py-expat/work/.gcc/bin:/work/pkgobj/textproc/py-expat/work/.tools/bin:/usr/pkg/bin:/root/bin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/X11
 R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin:/usr/pkg/bin:/usr/X11R7/bin PREFIX=/usr/pkg MAKELEVEL=0 CONFIG_SITE= PKG_SYSCONFDIR=/usr/pkg/etc CXXCPP=cpp HOME=/work/pkgobj/textproc/py-expat/work/.home CWRAPPERS_CONFIG_DIR=/work/pkgobj/textproc/py-expat/work/.cwrapper/config CPP=cpp LOCALBASE=/usr/pkg X11BASE=/usr/X11R7 PKGMANDIR=man PKGINFODIR=info PKGGNUDIR=gnu/ MAKECONF=/dev/null OBJECT_FMT=ELF USETOOLS=no BSD_INSTALL_PROGRAM=/usr/bin/install\ -c\ -s\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_SCRIPT=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_LIB=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_DATA=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 644 BSD_INSTALL_MAN=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 644 BSD_INSTALL=/usr/bin/install BSD_INSTALL_PROGRAM_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_SCRIPT_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_LIB_DIR=/usr/bin/install\ -d\ -o\ root\ -
 g\ wheel\ -m\ 755 BSD_INSTALL_DATA_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_MAN_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 755 BSD_INSTALL_GAME=/usr/bin/install\ -c\ -s\ -o\ root\ -g\ wheel\ -m\ 2555 BSD_INSTALL_GAME_DATA=/usr/bin/install\ -c\ -o\ root\ -g\ wheel\ -m\ 664 BSD_INSTALL_GAME_DIR=/usr/bin/install\ -d\ -o\ root\ -g\ wheel\ -m\ 775 INSTALL_INFO= MAKEINFO=/work/pkgobj/textproc/py-expat/work/.tools/bin/makeinfo FLEX= BISON= PKG_CONFIG= PKG_CONFIG_LIBDIR=/work/pkgobj/textproc/py-expat/work/.buildlink/lib/pkgconfig:/work/pkgobj/textproc/py-expat/work/.buildlink/share/pkgconfig PKG_CONFIG_LOG=/work/pkgobj/textproc/py-expat/work/.pkg-config.log PKG_CONFIG_PATH= CWRAPPERS_CONFIG_DIR=/work/pkgobj/textproc/py-expat/work/.cwrapper/config /usr/pkg/bin/python3.6  setup.py  build )
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x00007d8fda790800 (most recent call first):
[1]   Abort trap (core dumped) (cd /work/pkgobj...
*** Error code 134

Stop.
make[1]: stopped in /usr/pkgsrc/textproc/py-expat
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x0000778df480e800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x0000747a424c6800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x00007788b9c17800 (most recent call first):
[1]   Abort trap (core dumped) /usr/pkg/bin/pyt...
*** Error code 1

Stop.
make: stopped in /usr/pkgsrc/textproc/py-expat


>How-To-Repeat:

cd /usr/pkgsrc/textproc/py-expat
(sleep 10; make) 2>&1 > /tmp/pkg.log &
^D

and from another session: tail -f /tmp/pkg.log

>Fix:
n/a

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53229: textproc/py-expat does not build w/o terminal session
Date: Sun, 29 Apr 2018 12:17:59 +0200

 https://bugs.python.org/issue33384

From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53229: textproc/py-expat does not build w/o terminal session
Date: Sat, 19 May 2018 17:25:15 +0200

 Hello Martin,

 Martin Husemann writes:
 >
 >  https://bugs.python.org/issue33384
 >  

 JFTR (and to include a possible patch for lang/python36!), it seems
 that also NetBSD is affected by bpo-30225
 (<https://bugs.python.org/issue30225>).

 Extracting is_valid_fd() (from Python/pylifecycle.c) in an
 is_valid_fd.c to ease the reproduction (in python-3.6.5 USE_FSTAT
 logic is only honored by __APPLE__ and dup(2) is used on all the
 the other platforms):

  | % cat is_valid_fd.c
  | #include <stdio.h>
  | #include <sys/stat.h>
  | #include <unistd.h>
  | 
  | /* Check if a file descriptor is valid or not.
  |    Return 0 if the file descriptor is invalid, return
  |    non-zero otherwise. */
  | static int
  | is_valid_fd(int fd)
  | {
  | #ifdef USE_FSTAT 
  |     /* 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 such error. */
  |     struct stat st;
  |     return (fstat(fd, &st) == 0);
  | #else
  |     int fd2;
  |     if (fd < 0)
  |         return 0;
  |     /* Prefer dup() over fstat(). fstat() can require
  |        input/output whereas dup() doesn't, there is a low
  |        risk of EMFILE/ENFILE at Python startup. */
  |     fd2 = dup(fd);
  |     if (fd2 >= 0)
  |         close(fd2);
  |     return fd2 >= 0;
  | #endif
  | }
  | 
  | 
  | int
  | main(void)
  | {
  | 
  |     printf("0: %d\n", is_valid_fd(0));
  |     printf("1: %d\n", is_valid_fd(1));
  |     printf("2: %d\n", is_valid_fd(2));
  | 
  |     return 0;
  | }

 We can see (this is on NetBSD/amd64 8.99.15) that using dup(2):

  | % cc -o ivf is_valid_fd.c
  | % sleep 5 && ./ivf > /tmp/log & exit
  | [... the terminal is closed via ^D ...]
  | % cat /tmp/log
  | 0: 1
  | 1: 1
  | 2: 1

 ...and using fstat(2):

  | % cc -DUSE_FSTAT -o ivf is_valid_fd.c
  | % sleep 5 && ./ivf > /tmp/log & exit
  | [... the terminal is closed via ^D ...]
  | % cat /tmp/log
  | 0: 0
  | 1: 1
  | 2: 0

 The attached patch seems to fix that problem:

  <https://www.NetBSD.org/~leot/pkgsrc-patches/python36-3.6.5-bpo-33384.patch>

State-Changed-From-To: open->feedback
State-Changed-By: leot@NetBSD.org
State-Changed-When: Sat, 19 May 2018 15:35:59 +0000
State-Changed-Why:
Possible patch shared (seems to do the trick but I am not
super-confident about that)


From: Leonardo Taccari <leot@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53229: textproc/py-expat does not build w/o terminal session
Date: Mon, 21 May 2018 13:13:24 +0200

 And for completeness here the behaviours of just dup(2) and fstat(2)
 (please note that they can be safely ignored, but if you're
 curious...):

  | % cat sleep-and-dup.c
  | #include <errno.h>
  | #include <stdio.h>
  | #include <string.h>
  | #include <unistd.h>
  | =

  | =

  | int
  | main(void)
  | {
  | 	int fd;
  | =

  | 	if ((fd =3D dup(STDIN_FILENO)) !=3D -1)
  | 		printf("Before: %d\n", fd);
  | 	else
  | 		printf("%s\n", strerror(errno));
  | 	sleep(5);
  | 	if ((fd =3D dup(STDIN_FILENO)) !=3D -1)
  | 		printf("After: %d\n", fd);
  | 	else
  | 		printf("%s\n", strerror(errno));
  | 	return 0;
  | }
  | % cat sleep-and-fstat.c
  | #include <errno.h>
  | #include <sys/stat.h>
  | #include <stdio.h>
  | #include <string.h>
  | #include <unistd.h>
  | =

  | =

  | int
  | main(void)
  | {
  | 	struct stat st;
  | =

  | 	if (fstat(STDIN_FILENO, &st) !=3D -1)
  | 		printf("Before: %d\n", fstat(STDIN_FILENO, &st));
  | 	else
  | 		printf("%s\n", strerror(errno));
  | 	sleep(5);
  | 	if (fstat(STDIN_FILENO, &st) !=3D -1)
  | 		printf("Before: %d\n", fstat(STDIN_FILENO, &st));
  | 	else
  | 		printf("%s\n", strerror(errno));
  | 	return 0;
  | }
  | % cc sleep-and-dup.c -o dup
  | % cc sleep-and-fstat.c -o fstat
  | % ( ./dup > dup.log & ) && sleep 1 && exit
  | [... the terminal is closed ...]
  | % ( ./fstat > fstat.log & ) && sleep 1 && exit
  | [... the terminal is closed ...]
  | % cat dup.log
  | Before: 3
  | After: 4
  | % cat fstat.log
  | Before: 0
  | Bad file descriptor

 And according both 1003.1-2004 and 1003.1-2008, respectively for
 dup[0][1] in the ERRORS section we can read:

 > The dup() function shall fail if:
 > =

 > [EBADF]
 >     The fildes [oldfd in dup(2)] pargument is not a valid open file desc=
 riptor.
 > [...]

 In dup(2) regarding EBADF we have `oldfd is not a valid active descriptor'=
 .

 For fstat[2][3]:

 > The fstat() function shall fail if:
 > =

 > [EBADF]
 >     The fildes argument is not a valid file descriptor.
 > [...]

 In fstat(2) regarding EBADF we have `fd is not a valid open file descripto=
 r'.


 (So I guess that in the example above stdin is a valid /active/
 descriptor, while it is not a valid /open/ file descriptor!)


 [0]: <http://pubs.opengroup.org/onlinepubs/009695399/functions/dup.html>
 [1]: <http://pubs.opengroup.org/onlinepubs/9699919799/functions/dup.html>
 [2]: <http://pubs.opengroup.org/onlinepubs/009695399/functions/fstat.html>
 [3]: <http://pubs.opengroup.org/onlinepubs/9699919799/functions/fstat.html=
 >

Responsible-Changed-From-To: pkg-manager->leot
Responsible-Changed-By: leot@NetBSD.org
Responsible-Changed-When: Sun, 03 Jun 2018 20:11:21 +0000
Responsible-Changed-Why:
Take


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.