Gregory P. Smith <g...@krypto.org> added the comment:

The Linux kernel code is not sufficiently easy to follow to understand if it 
has this issue or if it pre-creates the dirent structures for all fds at 
opendir time for /proc/self/fd or if it is iterating through the list of fds in 
sorted order so an older closed fd will not interfere with its internal 
iteration.

Regardless, I've yet to knowingly witness a problem from this come up in 
practice.  knowingly and yet being key words. :)

But I like the general theme of your patch to set CLOEXEC on all of the fd's 
rather than explicitly call close(fd) in the directory reading loop.

----------
assignee:  -> gregory.p.smith
components: +Library (Lib)
resolution: out of date -> 
type:  -> behavior
versions: +Python 3.10, Python 3.9 -Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue21627>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to