[issue33384] Build does not work with closed stdin

Leonardo Taccari report at bugs.python.org
Sat May 19 10:45:48 EDT 2018


Leonardo Taccari <iamleot at gmail.com> 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 <report at bugs.python.org>
<https://bugs.python.org/issue33384>
_______________________________________


More information about the Python-bugs-list mailing list