gtristan commented on code in PR #1832:
URL: https://github.com/apache/buildstream/pull/1832#discussion_r1318095064


##########
src/buildstream/downloadablefilesource.py:
##########
@@ -235,8 +235,12 @@ def _ensure_mirror(self, activity_name: str):
                 return self.ref
 
             # Make sure url-specific mirror dir exists.
-            if not os.path.isdir(self._mirror_dir):
-                os.makedirs(self._mirror_dir)
+            try:
+                os.makedirs(self._mirror_dir, exist_ok=True)

Review Comment:
   This can happen whenever you have 2 separate elements which download the 
same downloadable file source.
   
   The later call to `os.rename()` below guarantees the required atomicity, but 
the call to `os.makedirs()` will collide in the case that both sources try to 
create the directory after both having passed the `not 
os.path.isdir(self._mirror_dir)` check.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to