[issue1675] Race condition in os.makedirs

Guido van Rossum report at bugs.python.org
Thu Dec 20 21:03:33 CET 2007


Guido van Rossum added the comment:

I think we can fix this as follows: whenever it calls os.mkdir() and an
error is returned, check if that is EISDIR or EEXISTS, and if so, check
that indeed it now exists as a directory, and then ignore the error.

Moreover, I'd like to do this for the ultimate path to be created as
well, so that os.makedirs(<existing directory>) will succeed instead of
failing.  This would make the common usage pattern much simpler.

I think it should still fail if the path exists as a file though.  (Or
as a symlink to a file.)

Patch welcome!

I think this is a feature request and hence should only be fixed in 2.6.

----------
nosy: +gvanrossum
priority:  -> low

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1675>
__________________________________


More information about the Python-bugs-list mailing list