-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix symlinking race condition #2765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import errno | ||
import getpass | ||
import logging | ||
import os | ||
|
@@ -153,3 +154,16 @@ def slugify(value, *args, **kwargs): | |
|
||
|
||
slugify = allow_lazy(slugify, six.text_type, SafeText) | ||
|
||
|
||
def safe_makedirs(directory_name): | ||
""" | ||
Makedirs has an issue where it has a race condition around | ||
checking for a directory and then creating it. | ||
This catches the exception in this case. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The failure case isn't clear, perhaps expand on what this is protecting against. |
||
""" | ||
|
||
try: | ||
os.makedirs(directory_name) | ||
except OSError: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this strictly catching |
||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this was brought in for this PR, it isn't used.