Charles-François Natali <neolo...@free.fr> added the comment: > Is there any reason to believe that the problem is confined to OS X?
It's a bit of a grey area. Here's what POSIX says: http://pubs.opengroup.org/onlinepubs/009695399/functions/readdir.html """ The pointer returned by readdir() points to data which may be overwritten by another call to readdir() on the same directory stream. This data is not overwritten by another call to readdir() on a different directory stream. """ So it seems safe as long as the threads are using distinct DIR *. However, the documentation also says this: """ The readdir() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe. """ So in theory, readddir() could use some static/global state which may make it not thread-safe. I just had a look at glibc's implementation, and it is indeed safe: http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/readdir.c;h=13e5e9a0213fcf37d5f289483439bff701a9708a;hb=HEAD Every "sane" implementation should be safe in practice. Now, it wouldn't be the first time we encounter such a stupid bug on OS X, but it would be nice to have a a short reproducer code in C to make sure. > It's also possible that readdir() is not reentrant with lstat() This doesn't make much sense to me. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13517> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com