diff mbox series

[wrynose,36/36] sstate: Detect broken sstate paths containing tmpdir

Message ID cfd31f0bce7cb8478dae4a84af81fd7679739d4c.1781960051.git.yoann.congal@smile.fr
State New
Headers show
Series [wrynose,01/36] gcc: Upgrade GCC to 15.3 release | expand

Commit Message

Yoann Congal June 20, 2026, 12:59 p.m. UTC
From: Richard Purdie <richard.purdie@linuxfoundation.org>

sstate objects should not contain TMPDIR paths. Detect this and error
if found as the side effects are quite problematic.

[YOCTO #16281]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 907af8fb448e2f9ecf8e0439f2d8c7c397fb873f)
Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/classes-global/sstate.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index 434557db77f..904a4148ddb 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -655,10 +655,15 @@  def sstate_package(ss, d):
                     continue
                 bb.error("sstate found an absolute path symlink %s pointing at %s. Please replace this with a relative link." % (srcpath, link))
                 exit = True
+            for dir in dirs:
+                dir = os.path.join(walkroot, dir).removeprefix(state[1])
+                if tmpdir in dir:
+                    bb.error("sstate found a tmpdir path reference in installation directiory %s which must be removed." % dir)
+                    exit = True
         bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
         bb.utils.rename(state[1], sstatebuild + state[0])
     if exit:
-        bb.fatal("Failing task due to absolute path symlinks")
+        bb.fatal("Failing task due to absolute path symlinks or tmpdir path reference")
 
     workdir = d.getVar('WORKDIR')
     sharedworkdir = os.path.join(d.getVar('TMPDIR'), "work-shared")