[issue20979] Calling getdents()/readdir64() repeatedly while closing descriptors provides unexpected behaviour.

Gregory P. Smith report at bugs.python.org
Thu Mar 20 00:09:08 CET 2014


Gregory P. Smith added the comment:

A Python test that reproduces this would be nice to have though I realize it isn't something necessarily useful to run as part of a unittest suite given this one would rely on OS kernel implementation details and chances of race conditions occurring.

Regardless I agree with the general comments.  This code could be improved with better error handling given the poor APIs for getting a list of open file descriptors that we have to work with.

It should be much less of an issue in 3.4 and later due to the O_CLOEXEC default via http://legacy.python.org/dev/peps/pep-0446/ but the posixsubprocess code should be updated to handle the errors better there regardless.

----------
nosy: +gregory.p.smith -gps
versions: +Python 3.3, Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20979>
_______________________________________


More information about the Python-bugs-list mailing list