A trailing slash or consecutive slashes anywhere in TMPDIR cause
BitBake variable expansion to embed those redundant slashes into
derived variables such as STAGING_DIR and WORKDIR.  The sstate
machinery in sstate_add() normalises its directory arguments via
os.path.normpath(), so manifest entries always contain clean paths.
Functions in staging.bbclass that read the same variables directly
via d.getVar() without normalising then fail to match manifest
entries, silently staging files to wrong locations and causing
do_populate_sysroot to abort.

Although POSIX permits paths with redundant slashes, they break the
string-matching assumptions embedded in the staging machinery, so
treat any TMPDIR that differs from its normalised form as an error.

Signed-off-by: Sam Povilus <[email protected]>
---
 meta/classes-global/sanity.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/classes-global/sanity.bbclass 
b/meta/classes-global/sanity.bbclass
index 5165bb34..7e81d659 100644
--- a/meta/classes-global/sanity.bbclass
+++ b/meta/classes-global/sanity.bbclass
@@ -953,6 +953,15 @@ def check_sanity_everybuild(status, d):
         if val.find('%') != -1:
             status.addresult("Error, you have an invalid character (%) in your 
%s directory path which causes problems with python string formatting. Please 
move the installation to a directory which doesn't include any % characters." % 
checkdir)
 
+    # Redundant slashes (trailing slash or consecutive slashes) in TMPDIR
+    # break the sstate staging machinery which relies on exact string matching
+    # of manifest paths.  Reject any TMPDIR that differs from its normalised 
form.
+    tmpdir = d.getVar('TMPDIR')
+    if tmpdir and tmpdir != os.path.normpath(tmpdir):
+        status.addresult("Error, TMPDIR (%s) contains redundant slashes. "
+            "Please set TMPDIR to a clean path with no trailing slash or "
+            "consecutive slashes (e.g. %s).\n" % (tmpdir, 
os.path.normpath(tmpdir)))
+
     # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
     import re
     mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#231971): 
https://lists.openembedded.org/g/openembedded-core/message/231971
Mute This Topic: https://lists.openembedded.org/mt/117998148/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to