Bug 15377 - ${D}/sysroot-only has race between do_populate_sysroot and do_package
Summary: ${D}/sysroot-only has race between do_populate_sysroot and do_package
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: core (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium normal
Target Milestone: 5.1
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2024-01-31 13:14 UTC by Callum Moffat
Modified: 2024-10-10 12:08 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Callum Moffat 2024-01-31 13:14:37 UTC
If both do_package and do_populate_sysroot tasks need to be run for a recipe, they may both run at the same time, because there isn't any specific dependency between them, besides the fact they both depend on do_install. If the /sysroot-only feature is used, it can cause an issue, because do_package may delete the /sysroot-only directory before do_populate_sysroot can copy it to the sysroot directory.

If you use /sysroot-only, you could force the dependency with the following snippet in recipe

do_package[depends] += "${PN}:do_populate_sysroot"

But I think in oe-core, staging.bbclass and/or package.bbclass should be adjusted to avoid this race by default. Either the task order could be specified, or do_package could be changed to avoid mutating ${D}.
Comment 1 Richard Purdie 2024-02-01 15:01:00 UTC
We need to stop it chamging ${D}
Comment 2 Randy MacLeod 2024-02-01 15:43:44 UTC
Not a common error and unlikely so medium priority.
Comment 3 Ross Burton 2024-10-10 11:42:52 UTC
Callum: where you using an old release when you found this bug?  It appears to be resolved with poky f2016af0399250d2378818758c704c37a96e2ed6 which was in 4.1 onwards.

Basically the patch does this:

-        shutil.rmtree(sysroot_only)

-    cmd = 'tar -cf - -C %s -p -S . | tar -xf - -C %s' % (dest, dvar)
+    cmd = 'tar --exclude=./sysroot-only -cf - -C %s -p -S . | tar -xf - -C %s' % (dest, dvar)

Closing as I believe this is fixed.
Comment 4 Callum Moffat 2024-10-10 12:08:09 UTC
Oh you're right I am not at 4.1 yet. Yeah that snippet would fix it. Thanks.