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

SourceForge.net noreply at sourceforge.net
Sun Jul 17 21:57:13 CEST 2005


Patches item #1239890, was opened at 2005-07-17 21:42
Message generated for change (Comment added) made by birkenfeld
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.

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

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-07-17 21:57

Message:
Logged In: YES 
user_id=1188172

See bug #1223238.

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

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