[v2] archiver: exit to avoid race conditions

Message ID 20220527102801.3733241-1-jose.quaresma@foundries.io
State New
Headers show
Series [v2] archiver: exit to avoid race conditions | expand

Commit Message

Jose Quaresma May 27, 2022, 10:28 a.m. UTC
The archiver doesn't support using multiconfig sharing the same TMPDIR
so rise an error when we have something that shouldn't exist.

When in the multiconfig and using the same TMPDIR: the two machines can make
the same copy at the same time to the same destination, which will not work.

Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---

 v2: replace "bb.error" with "bb.fatal"

 meta/classes/archiver.bbclass | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index c19c770d11..87c0f90252 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -486,6 +486,8 @@  python do_unpack_and_patch() {
     if d.getVarFlag('ARCHIVER_MODE', 'diff') == '1':
         src = d.getVar('S').rstrip('/')
         src_orig = '%s.orig' % src
+        if os.path.isdir(src_orig):
+            bb.fatal("A previous copy of the original source already exist '%s'" % src_orig)
         oe.path.copytree(src, src_orig)
 
     if bb.data.inherits_class('dos2unix', d):