Ticket #11972 (closed enhancement: fixed)
avoid race conditions when creating directories
|Reported by:||jhpalmieri||Owned by:||jason|
|Report Upstream:||N/A||Reviewers:||Jeroen Demeyer|
|Authors:||John Palmieri||Merged in:||sage-4.8.alpha0|
Description (last modified by jdemeyer) (diff)
It is much better to create directories using
try: os.makedirs(PATH) except OSError.... # ignore errors if PATH already exists, deal with other errors ...
if not os.path.isdir(PATH): os.makedirs(PATH)
Doing it the first way avoids race conditions. Doing it the second way can lead to security holes, at least in theory. The attached patch changes many of the directory-creating code in Sage to do it the first way.
- Reviewers set to Jeroen Demeyer
- Description modified (diff)
comment:10 Changed 19 months ago by jdemeyer
- Status changed from needs_review to closed
- Resolution set to fixed
- Merged in set to sage-4.7.3.alpha0