[Patches] [ python-Patches-1608579 ] Race condition in os.makedirs

SourceForge.net noreply at sourceforge.net
Sat Dec 9 10:10:51 CET 2006


Patches item #1608579, was opened at 2006-12-04 16:52
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1608579&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: James Bowes (jbowes)
Assigned to: Nobody/Anonymous (nobody)
Summary: Race condition in os.makedirs

Initial Comment:
os.makedirs first checks if the non-leaf part of the path exists, and then calls makedirs on this part of the path to create it. If the path is created in between the call to path.exists, and the recursive call to os.makedirs, then  os.makedirs will raise an exception.

The attached patch catches this exception, and then tests if the exception is caused by a the file/directory's existence. If it is, the exception is ignored. If not, it is rasied.

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-12-09 09:10

Message:
Logged In: YES 
user_id=849994
Originator: NO

Committed as rev. 52972, 52973 (2.5).

----------------------------------------------------------------------

Comment By: Han-Wen Nienhuys (hanwen)
Date: 2006-12-05 23:58

Message:
Logged In: YES 
user_id=161998
Originator: NO

looks good to me.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1608579&group_id=5470


More information about the Patches mailing list