-
Notifications
You must be signed in to change notification settings - Fork 280
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
Fix potential race condition in 'download_checkmd5.py' #715
Conversation
if len(dirname): | ||
try: | ||
os.makedirs(dirname) | ||
except OSError, e: |
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.
Please use Python 3 compatible syntax:
except OSError as e:
07a0ee4
to
f73a486
Compare
Other than the comments that looks reasonable, +1. Thanks! |
f73a486
to
74c1e65
Compare
try: | ||
os.makedirs(dirname) | ||
except OSError as e: | ||
import errno |
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.
Please move the import to the top of the file (between __future__
and os
).
Also please comment on the ticket when committing changes. Otherwise we don't get a notification. |
74c1e65
to
a9ad503
Compare
Ok, sorry for the inconvenience. I have looked into the comments and modified my commit accordingly. |
Np. Thank you for the patch. |
Fix potential race condition in 'download_checkmd5.py'
When trying to download multiple files in the same directory, using
catkin_download_test_data
, there is a race condition (ifmake
has been called with-jN
, where N>1) because 2 or more threads are trying to create the same directory.I have created a simple package to reproduce that issue. The only thing that package does, is to declare 2 calls to
catkin_download_test_data
in the CMakeLists.txt, where theDESTINATION
is the same directory.The error I get is the following:
You can reproduce the same error, cloning that package and running
catkin_make tests
.This pull request is supposed to resolve that issue.