[issue14702] os.makedirs breaks under autofs directories
Charles-François Natali
report at bugs.python.org
Sat May 5 15:27:30 CEST 2012
Charles-François Natali <neologix at free.fr> added the comment:
> Charles, I don't think you can blame autofs here. The problem at hand is that makedirs() never checks whether the directory exists (that would trigger the mount too I presume).
Yes, it does. Have a look at line 148:
"""
if head and tail and not path.exists(head):
"""
> Instead, it tries a mkdir and looks if it gets an EEXIST.
Actually, EEXIST is just caught to cope with race conditions (i.e. the
directory got created in between, TOCTTOU race).
> If you try that approach in this case where /net is non-writable and /net/prodigy appears only on demand, it fails with an EPERM instead.
Actually, no.
makedirs() does a recursive depth-first traversal:
makedirs('/net/prodigy/foo') will actually do something like:
"""
stat('/net/prodigy/foo') == ENOENT
stat('/net/prodigy') == ENONENT
mkdir('/net/prodigy') == EPERM
"""
The NFS mount should appear upon the first - or second - stat() call,
before mkdir().
But I'd like to be sure about that, that's why I think an strace()
output would be useful ;-)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14702>
_______________________________________
More information about the Python-bugs-list
mailing list