Skip to contentSkip to conversation

fetch2: Ensure we don't have file downloads overwriting each other

PATCH New Richard Purdie 1 participant 1 message Mar 28, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fetch2: Ensure we don't have file downloads overwriting each other

Imagine you have an sstate mirror accessed over http and an SSTATE_MIRRORS which maps file:// urls to http:// urls.

File urls set donestampneeded = False, http urls don't. This can result in races in the try_mirror_url() code since it will trigger new downloads after aquiring the lockfile as verify_donestamp() doesn't look at origud and there is no donestamp.

verify_donestamp() already has code to look at origud, we're just missing some code at the start of the function to do this. Fix it to avoid these races.

---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +1 -1
index 464e66b..ea72025 100644
@@ -625,7 +625,7 @@ def verify_donestamp(ud, d, origud=None):
     Returns True, if the donestamp exists and is valid, False otherwise. When
     returning False, any existing done stamps are removed.
     """
-    if not ud.needdonestamp:
+    if not ud.needdonestamp or (origud and not origud.needdonestamp):
         return True
 
     if not os.path.exists(ud.donestamp):
Signature · 1 line
2.7.4