Skip to contentSkip to conversation

utils: Improve multiple lock handling

PATCH New Richard Purdie 1 participant 1 message Oct 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 utils: Improve multiple lock handling

We should release locks in the opposite order to the order we locked them in to avoid potentially problematic behaviour. This hasn't been observed with our current usage and is just a preventative improvement.

---
 lib/bb/utils.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/utils.py +1 -0
index ebee65d3dd..e722f9113d 100644
@@ -446,6 +446,7 @@ def fileslocked(files, *args, **kwargs):
     try:
         yield
     finally:
+        locks.reverse()
         for lock in locks:
             bb.utils.unlockfile(lock)