[issue33384] Build does not work with closed stdin on NetBSD

2019-10-24 Thread Leonardo Taccari


Leonardo Taccari  added the comment:

Hello Victor,
I can confirm that I can no longer reproduce this problem with Python
3.7.5 on NetBSD and according a double-check to
Python/pylifecycle.c:is_valid_fd() now fstat() is always used on
NetBSD.

Thanks for the update and for looking at it!

--

___
Python tracker 
<https://bugs.python.org/issue33384>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33384] Build does not work with closed stdin

2018-05-19 Thread Leonardo Taccari

Leonardo Taccari  added the comment:

A simpler way to reproduce that (probably this problem is not limited to
building but to sys module):

(sleep 10; python3.6 -c 'import sys' >/tmp/log 2>&1) & exit

And in `/tmp/log':

Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor
 
Current thread 0x7226e0ab3800 (most recent call first):

--
nosy: +leot

___
Python tracker 
<https://bugs.python.org/issue33384>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33384] Build does not work with closed stdin

2018-05-19 Thread Leonardo Taccari

Leonardo Taccari  added the comment:

And here the backtrace of the corresponding core (this is on
NetBSD/amd64 8.99.15 with lang/python36 package of today pkgsrc-current):

% gdb -core python3.6.core `which python3.6`
Reading symbols from /usr/pkg/bin/python3.6...done.
[New process 1]
Core was generated by `python3.6'.
Program terminated with signal SIGABRT, Aborted.
#0  0x76255932924a in _lwp_kill () from /usr/lib/libc.so.12
(gdb) bt
#0  0x76255932924a in _lwp_kill () from /usr/lib/libc.so.12
#1  0x762559328e65 in abort () at /usr/src/lib/libc/stdlib/abort.c:74
#2  0x76255a749d33 in Py_FatalError (msg=msg@entry=0x76255a7dea20 
"Py_Initialize: can't initialize sys standard streams")
at Python/pylifecycle.c:1462
#3  0x76255a74af4c in _Py_InitializeEx_Private (install_sigs=1, 
install_importlib=1) at Python/pylifecycle.c:450
#4  0x76255a764902 in Py_Main (argc=argc@entry=3, 
argv=argv@entry=0x76255ab01060) at Modules/main.c:700
#5  0x00400e2f in main (argc=3, argv=) at 
./Programs/python.c:69
(gdb) f 4
#4  0x76255a764902 in Py_Main (argc=argc@entry=3, 
argv=argv@entry=0x76255ab01060) at Modules/main.c:700
700 Py_Initialize();
(gdb) f 3
#3  0x76255a74af4c in _Py_InitializeEx_Private (install_sigs=1, 
install_importlib=1) at Python/pylifecycle.c:450
450 Py_FatalError(
(gdb) list
445 if (_PyTraceMalloc_Init() < 0)
446 Py_FatalError("Py_Initialize: can't initialize 
tracemalloc");
447
448 initmain(interp); /* Module __main__ */
449 if (initstdio() < 0)
450 Py_FatalError(
451 "Py_Initialize: can't initialize sys standard streams");
452
453 /* Initialize warnings. */
454 if (PySys_HasWarnOptions()) {

Please let me know if any further information is needed and I will try
to help!

Thank you!

--

___
Python tracker 
<https://bugs.python.org/issue33384>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33384] Build does not work with closed stdin

2018-05-19 Thread Leonardo Taccari

Leonardo Taccari  added the comment:

After testing is_valid_fd() (from Python/pylifecycle.c) separately
(an `is_valid_fd.c' file will be attached to ease reproduction) I think
that also NetBSD is affected by bpo-30225.

Using dup(2) (at is currently done in NetBSD):

% 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

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 possible attached patch seems to fix the problem reported by Martin.

--
Added file: https://bugs.python.org/file47604/patch-Python_pylifecycle.c

___
Python tracker 
<https://bugs.python.org/issue33384>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33384] Build does not work with closed stdin

2018-05-19 Thread Leonardo Taccari

Change by Leonardo Taccari :


Added file: https://bugs.python.org/file47605/is_valid_fd.c

___
Python tracker 
<https://bugs.python.org/issue33384>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com