Skip to contentSkip to conversation

sanity.bbclass: check if PSEUDO_IGNORE_PATHS and paths under pseudo control overlap

PATCH Superseded Dorinda 2 participants 3 messages Jan 31, 2021 – Feb 1, 2021

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Dorinda

author
#0 lore raw

PATCH v3 1/1 sanity.bbclass: check if PSEUDO_IGNORE_PATHS and paths under pseudo control overlap

added a sanity check for when PSEUDO_IGNORE_PATHS and paths under pseudo control overlap to avoid random failures generated.

[YOCTO #14193]

---
v3:
changed commit log
changed the conditional statement for sanity check

 meta/classes/sanity.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/sanity.bbclass +10 -0
index c6842ff549..a64d15166f 100644
@@ -710,6 +710,16 @@ def check_sanity_version_change(status, d):
         if i and workdir.startswith(i):
             status.addresult("You are building in a path included in PSEUDO_IGNORE_PATHS " + str(i) + " please locate the build outside this path.\n")
 
+    # Check if PSEUDO_IGNORE_PATHS and and paths under pseudo control overlap
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
+    pseudo_control_dir = "${D},${PKGD},${PKGDEST},${IMAGEROOTFS},${SDK_OUTPUT}"
+    pseudocontroldir = d.getVar('pseudo_control_dir', expand=True).split(",")
+    for i in pseudoignorepaths:
+        for j in pseudocontroldir:
+            if i and j:
+                if j.startswith(i):
+                    status.addresult("a path included in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " are overlapping each other, please set this path " + str(j) + " to point to a different directory. \n")
+
     # Some third-party software apparently relies on chmod etc. being suid root (!!)
     import stat
     suid_check_bins = "chown chmod mknod".split()
Signature · 1 line
2.17.1
#1 lore raw

meta/classes/sanity.bbclass def check_sanity_version_change(status, d): · line 716

Quoted 5 lines · Dorinda
meta/classes/sanity.bbclass +4 -0
+    # Check if PSEUDO_IGNORE_PATHS and and paths under pseudo control overlap
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
+    pseudo_control_dir = "${D},${PKGD},${PKGDEST},${IMAGEROOTFS},${SDK_OUTPUT}"
+    pseudocontroldir = d.getVar('pseudo_control_dir', expand=True).split(",")

I'm not sure that would actually work without a setVar as pseudo_control_dir isn't a variable.

What you probably want is:

pseudocontroldir = d.expand(pseudo_control_dir, expand=True).split(",")

How did you test this? Did you try setting S = "${WORKDIR}/pack" in a recipe to ensure it correctly detects the issue?

meta/classes/sanity.bbclass def check_sanity_version_change(status, d): · line 721

Quoted 5 lines
meta/classes/sanity.bbclass +5 -0
+    for i in pseudoignorepaths:
+        for j in pseudocontroldir:
+            if i and j:
+                if j.startswith(i):
+                    status.addresult("a path included in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " are overlapping each other, please set this path " + str(j) + " to point to a different directory. \n")

How about improving this to:

'''
A path in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " overlap and this will break pseudo permission and ownership tracking. Please set the path " + str(j) + " to a different directory which does not overlap with pseudo controlled directories.
'''

Cheers,

Richard

author
#2 lore raw

I agree.
Thanks for the helpful hints here, will be more thorough in future patches :)

Thanks,
Dorinda

On Jan 31, 2021 22:50, "Richard Purdie" <[email protected]> wrote:

Quoted 2 lines · Dorinda

+ # Check if PSEUDO_IGNORE_PATHS and and paths under pseudo control

overlap

Quoted 1 line

+ pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS',

expand=True).split(",")

Quoted 1 line

+ pseudo_control_dir = "${D},${PKGD},${PKGDEST},${

IMAGEROOTFS},${SDK_OUTPUT}"

Quoted 1 line

+ pseudocontroldir = d.getVar('pseudo_control_dir',

expand=True).split(",")

I'm not sure that would actually work without a setVar as pseudo_control_dir isn't a variable.

What you probably want is:

pseudocontroldir = d.expand(pseudo_control_dir, expand=True).split(",")

How did you test this? Did you try setting S = "${WORKDIR}/pack" in a recipe to ensure it correctly detects the issue?

meta/classes/sanity.bbclass def check_sanity_version_change(status, d):

Quoted 5 lines
meta/classes/sanity.bbclass +5 -0
+    for i in pseudoignorepaths:
+        for j in pseudocontroldir:
+            if i and j:
+                if j.startswith(i):
+                    status.addresult("a path included in

PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " are overlapping each other, please set this path " + str(j) + " to point to a different directory. \n")

How about improving this to:

'''
A path in PSEUDO_IGNORE_PATHS " + str(i) + " and the path " + str(j) + " overlap and this will break pseudo permission and ownership tracking. Please set the path " + str(j) + " to a different directory which does not overlap with pseudo controlled directories.
'''

Cheers,

Richard