[Patches] [ python-Patches-1239890 ] Prevent race condition in os.makedirs

SourceForge.net noreply at sourceforge.net
Sun Jul 17 21:42:09 CEST 2005


Patches item #1239890, was opened at 2005-07-17 22:42
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=1239890&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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nir Soffer (nirs)
Assigned to: Nobody/Anonymous (nobody)
Summary: Prevent race condition in os.makedirs

Initial Comment:
makedirs check if a directory exists, and call mkdir to create it. In 
rare cases, the directory might have been created by another 
process or thread in the time passed from the exists() call to the 
mkdir() call.

To prevent this rare race condition, use try: expect: to create the 
directory, then ignore "File exists" errors, which mean the directory 
was there.

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

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


More information about the Patches mailing list