* [PATCH 0/1] rm_work: recipe self-exclusion vs conditional RM_WORK_EXCLUDE
@ 2026-07-25 14:30 Zk47T
2026-07-25 14:30 ` [PATCH 1/1] rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is conditional Zk47T
0 siblings, 1 reply; 2+ messages in thread
From: Zk47T @ 2026-07-25 14:30 UTC (permalink / raw)
To: openembedded-core; +Cc: zizuzacker
Reported in [YOCTO #16157]: with rm_work enabled and
RM_WORK_EXCLUDE:qemuarm64 += "bash"
in local.conf the build breaks, at gcc-source do_patch for the reporter.
Still reproduces on master.
The recipe the user named is fine. What breaks is every recipe that
excludes itself with RM_WORK_EXCLUDE += "${PN}": += appends to the base
value, and the override then hides it from both guards in the class.
Details in the patch.
gcc-source is the one that hurts. Its WORKDIR is the shared source tree
the other gcc recipes build from, and it gets deleted despite the
exclusion: 1.4G of unpacked, patched source down to an empty directory.
On the next build that needs it, bitbake re-runs do_fetch, do_unpack,
do_patch and do_preconfigure to put it back, which is exactly what the
exclusion is there to avoid.
Being precise about the failure mode, since it decides how bad this is:
what I reproduced is the deletion and the redundant rebuild, and in a
two-step build (gcc-source, then gcc-cross) it recovers on its own. The
reporter's hard failure at gcc-source do_patch I have not reproduced. It
looks like a race, since nothing orders gcc-source's do_rm_work against
other recipes still reading that directory, which would also explain why
they saw it in different places on different projects. Either way the
exclusion is being silently defeated.
Note it only shows up on a cold build: with warm sstate the tree is still
deleted, but nothing needs it again.
On why only four recipes: six places in oe-core exclude a recipe, and the
kernel case plus externalsrc.bbclass already use d.appendVar() and were
never affected. The four using += all descend from 1f2a3cdadac1
("gcc-source.inc: cleanly disable do_rm_work"), which dropped deltask and
settled on RM_WORK_EXCLUDE as "the API that is meant to be used for
excluding recipes from cleaning". deltask had no exposure to this, so
that is where gcc-source regressed. The mechanism is fine and unchanged
here, only the operator is wrong.
:append is never weaker: += is lost for all three override forms
(:<machine> =, :<machine> += and :pn-<recipe>), :append survives all of
them, and with no override both give the same string so nothing rebuilds.
Making the class tolerant instead, by unioning the resolved value with
the masked base, does not work: getVarFlag() checks expand_cache before
honouring the parsing argument and parsing is not in the cache key, so
the second read returns the first one's answer. Looks like a separate
bitbake issue.
Not fixed here: RM_WORK_EXCLUDE:<machine> += "x" still replaces rather
than adds, so combining it with a plain += loses the latter. That is
ordinary override behaviour, so the patch just documents the working form
in the class header.
Tested on qemux86-64 with rm_work and RM_WORK_EXCLUDE:qemux86-64 +=
"bash", patch applied to a pristine 9d89b3b802 with unpatched bitbake:
- bitbake gcc-source with an empty sstate: unpatched leaves an empty
work-shared, patched leaves the 1.4G source tree intact
- all four recipes keep their own name in RM_WORK_EXCLUDE again
- with an unconditional RM_WORK_EXCLUDE the resolved value is byte
identical before and after
- all 952 recipes parse, core-image-minimal builds, 5608 tasks
- oe-core patchtest: 10 pass, rest skipped as not applicable
Nguyen Minh Tien (1):
rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is
conditional
meta/classes/rm_work.bbclass | 6 ++++++
meta/recipes-core/meta/meta-ide-support.bb | 2 +-
meta/recipes-core/meta/wic-tools.bb | 2 +-
meta/recipes-devtools/clang/llvm-project-source.inc | 2 +-
meta/recipes-devtools/gcc/gcc-source.inc | 2 +-
5 files changed, 10 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [PATCH 1/1] rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is conditional
2026-07-25 14:30 [PATCH 0/1] rm_work: recipe self-exclusion vs conditional RM_WORK_EXCLUDE Zk47T
@ 2026-07-25 14:30 ` Zk47T
0 siblings, 0 replies; 2+ messages in thread
From: Zk47T @ 2026-07-25 14:30 UTC (permalink / raw)
To: openembedded-core; +Cc: zizuzacker
A recipe keeps its WORKDIR by adding itself to the exclusion list:
RM_WORK_EXCLUDE += "${PN}"
+= is evaluated at parse time against the unoverridden variable, so it
appends to the base value. As soon as configuration sets an override such
as RM_WORK_EXCLUDE:qemuarm64, that override takes precedence at lookup
time and the recipe's own entry is hidden from both the python guard in
inject_rm_work() and the shell guard in do_rm_work.
The WORKDIR is then removed even though it was meant to be kept. For
gcc-source that is the shared source tree the other gcc recipes build
from, 1.4G here, so the next build needing it fetches, unpacks and
patches it again, and anything still using it while do_rm_work runs can
fail outright. The report has gcc-source do_patch failing.
Use :append, which is applied on top of whichever override wins. With no
override involved both operators produce the same string, so task
signatures and sstate are unaffected.
gcc-source used deltask, which had no such failure mode, until
1f2a3cdadac1 switched it to this idiom; the other three recipes adopted
the idiom afterwards.
Fixes: 1f2a3cdadac1 ("gcc-source.inc: cleanly disable do_rm_work")
[YOCTO #16157]
Signed-off-by: Nguyen Minh Tien <zizuzacker@gmail.com>
---
meta/classes/rm_work.bbclass | 6 ++++++
meta/recipes-core/meta/meta-ide-support.bb | 2 +-
meta/recipes-core/meta/wic-tools.bb | 2 +-
meta/recipes-devtools/clang/llvm-project-source.inc | 2 +-
meta/recipes-devtools/gcc/gcc-source.inc | 2 +-
5 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/meta/classes/rm_work.bbclass b/meta/classes/rm_work.bbclass
index 52ecfafb72..cdef74f6a7 100644
--- a/meta/classes/rm_work.bbclass
+++ b/meta/classes/rm_work.bbclass
@@ -16,6 +16,12 @@
#
# RM_WORK_EXCLUDE += "icu-native icu busybox"
#
+# += does not combine with a conditional value, so use :append if either the
+# configuration or a recipe excluding itself may be overridden:
+#
+# RM_WORK_EXCLUDE:append:qemuarm64 = " busybox"
+# RM_WORK_EXCLUDE:append = " ${PN}"
+#
# Recipes can also configure which entries in their ${WORKDIR}
# are preserved besides temp, which already gets excluded by default
# because it contains logs:
diff --git a/meta/recipes-core/meta/meta-ide-support.bb b/meta/recipes-core/meta/meta-ide-support.bb
index c449302923..222ae21b29 100644
--- a/meta/recipes-core/meta/meta-ide-support.bb
+++ b/meta/recipes-core/meta/meta-ide-support.bb
@@ -4,7 +4,7 @@ LICENSE = "MIT"
PACKAGE_ARCH = "${MACHINE_ARCH}"
DEPENDS = "virtual/libc ${MLPREFIX}gdb-cross-${TARGET_ARCH} qemu-native qemu-helper-native unfs3-native cmake-native autoconf-native automake-native meson-native intltool-native pkgconfig-native"
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
inherit toolchain-scripts nopackages deploy testsdk
diff --git a/meta/recipes-core/meta/wic-tools.bb b/meta/recipes-core/meta/wic-tools.bb
index 823dbe6db6..9123f6e55a 100644
--- a/meta/recipes-core/meta/wic-tools.bb
+++ b/meta/recipes-core/meta/wic-tools.bb
@@ -23,7 +23,7 @@ inherit nopackages
# The sysroot of wic-tools is needed for wic, but if rm_work is enabled, it will
# be removed before wic has a chance to use it, hence the exclusion below.
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
python do_build_sysroot () {
bb.build.exec_func("extend_recipe_sysroot", d)
diff --git a/meta/recipes-devtools/clang/llvm-project-source.inc b/meta/recipes-devtools/clang/llvm-project-source.inc
index 85b5ef06dc..af601914bc 100644
--- a/meta/recipes-devtools/clang/llvm-project-source.inc
+++ b/meta/recipes-devtools/clang/llvm-project-source.inc
@@ -3,7 +3,7 @@ deltask do_compile
deltask do_install
deltask do_populate_sysroot
deltask do_populate_lic
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
inherit nopackages allarch
diff --git a/meta/recipes-devtools/gcc/gcc-source.inc b/meta/recipes-devtools/gcc/gcc-source.inc
index d760171661..d2bb5222bf 100644
--- a/meta/recipes-devtools/gcc/gcc-source.inc
+++ b/meta/recipes-devtools/gcc/gcc-source.inc
@@ -3,7 +3,7 @@ deltask do_compile
deltask do_install
deltask do_populate_sysroot
deltask do_populate_lic
-RM_WORK_EXCLUDE += "${PN}"
+RM_WORK_EXCLUDE:append = " ${PN}"
inherit nopackages allarch
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-26 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-25 14:30 [PATCH 0/1] rm_work: recipe self-exclusion vs conditional RM_WORK_EXCLUDE Zk47T
2026-07-25 14:30 ` [PATCH 1/1] rm_work: fix recipe self-exclusion lost when RM_WORK_EXCLUDE is conditional Zk47T
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox