Thread (8 messages) 8 messages, 2 authors, 2021-11-01
STALE1726d

[PATCH] sstate: Consider .lock suffix for when loading sstate file from mirror

From: Manuel Leonhardt <hidden>
Date: 2021-10-31 20:08:58
Subsystem: the rest · Maintainer: Linus Torvalds

When using an sstate mirror over HTTP/S, a lockfile is created during
download. Previously, this resulted in an OSError (ENAMETOOLONG) in the
bb.utils.lockfile function because the lockfile has the filename of the
sstate file plus ".lock". Since this case is also not handled properly
in bb.utils.lockfile, this caused populate tasks to hang indefinitely.

Also, previously when generating a shorter filename, the reserved
characters for .siginfo and now .lock were not considered. This is now
fixed by using limit instead of 254, which is the maximum length.

Signed-off-by: Manuel Leonhardt <redacted>
---
 meta/classes/sstate.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 6e4eb09f8e..b6a8951f8a 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -14,6 +14,8 @@ def generate_sstatefn(spec, hash, taskname, siginfo, d):
     if siginfo:
         limit = 254
         extension = ".tar.zst.siginfo"
+    # 5 chars reserved for .lock suffix when downloading from sstate mirror
+    limit -= 5
     if not hash:
         hash = "INVALID"
     fn = spec + hash + "_" + taskname + extension
@@ -22,7 +24,7 @@ def generate_sstatefn(spec, hash, taskname, siginfo, d):
         components = spec.split(":")
         # Fields 0,5,6 are mandatory, 1 is most useful, 2,3,4 are just for information
         # 7 is for the separators
-        avail = (254 - len(hash + "_" + taskname + extension) - len(components[0]) - len(components[1]) - len(components[5]) - len(components[6]) - 7) // 3
+        avail = (limit - len(hash + "_" + taskname + extension) - len(components[0]) - len(components[1]) - len(components[5]) - len(components[6]) - 7) // 3
         components[2] = components[2][:avail]
         components[3] = components[3][:avail]
         components[4] = components[4][:avail]
-- 
2.33.1


_______________________________________________________
Manuel 
Leonhardt
Softwareentwickler
​
ARRI
Arnold & Richter Cine Technik GmbH & Co. Betriebs KG 
Herbert-Bayer-Str. 10, 
80807 
München
www.arri.com 

+49 89 3809-1719
MLeonhardt@arri.de

​
Get all the latest information from www.arri.com, Facebook, Twitter, Instagram and YouTube.

Arnold & Richter Cine Technik GmbH & Co. Betriebs KG
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRA 57918
Persönlich haftender Gesellschafter: Arnold & Richter Cine Technik GmbH
Sitz: München - Registergericht: Amtsgericht München - Handelsregisternummer: HRB 54477
Geschäftsführer: Dr. Michael Neuhäuser; Stephan Schenk; Walter Trauninger; Markus Zeiler

​

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help