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

SourceForge.net noreply at sourceforge.net
Mon Dec 4 17:52:43 CET 2006


Patches item #1608579, was opened at 2006-12-04 11:52
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
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.

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

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