Skip to contentSkip to conversation

sanity.bbclass: check if PSEUDO_IGNORE_PATHS and ${S} overlap

PATCH In review Dorinda 2 participants 4 messages Jan 28, 2021 – Jan 31, 2021

lore
Share & tools
lore

Dorinda

author
#0 lore raw

PATCH v2 1/1 sanity.bbclass: check if PSEUDO_IGNORE_PATHS and ${S} overlap

added a sanity check for when PSEUDO_IGNORE_PATHS and ${S} overlap to avoid random failures generated.

[YOCTO #14193]

---
v2:
added a condition for when {WORKDIR}={S}

 meta/classes/sanity.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/sanity.bbclass +10 -0
index c6842ff549..63284b7917 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 ${S} overlap
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
+    workdir = d.getVar('WORKDIR')
+    sourcefile = d.getVar('S')
+    if (workdir == sourcefile):
+        for i in pseudoignorepaths:
+            if i and sourcefile:
+                if sourcefile.startswith(i) or i.startswith(sourcefile):
+                    status.addresult("a path included in PSEUDO_IGNORE_PATHS " + str(i) + " and ${S} (source files) path " + str(sourcefile) + " are overlapping each other, please set ${S} in your recipe 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
author
#1 lore raw

This patch won't be necessary as the previous patch here
https://listshanks.openembedded.org/g/openembedded-core/message/147238?p=,,,20,0,0,0::Created,,verify+that+user,20,2,0,80117826
would detect it.

Thanks,
Dorinda

Quoted 45 lines · dorindabassey

added a sanity check for when PSEUDO_IGNORE_PATHS and ${S} overlap to avoid random failures generated.

[YOCTO #14193]

---
v2:
added a condition for when {WORKDIR}={S}

 meta/classes/sanity.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/sanity.bbclass +0 -0
index c6842ff549..63284b7917 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")

meta/classes/sanity.bbclass +2 -0
+    # Check if PSEUDO_IGNORE_PATHS and ${S} overlap
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS',

expand=True).split(",")

meta/classes/sanity.bbclass +7 -0
+    workdir = d.getVar('WORKDIR')
+    sourcefile = d.getVar('S')
+    if (workdir == sourcefile):
+        for i in pseudoignorepaths:
+            if i and sourcefile:
+                if sourcefile.startswith(i) or i.startswith(sourcefile):
+                    status.addresult("a path included in

PSEUDO_IGNORE_PATHS " + str(i) + " and ${S} (source files) path " + str(sourcefile) + " are overlapping each other, please set ${S} in your recipe 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()
--
2.17.1

#2 lore raw
In reply to Dorinda
Quoted 33 lines · Dorinda

added a sanity check for when PSEUDO_IGNORE_PATHS and ${S} overlap to avoid random failures generated.

[YOCTO #14193]

---
v2:
added a condition for when {WORKDIR}={S}

 meta/classes/sanity.bbclass | 10 ++++++++++

 1 file changed, 10 insertions(+)
meta/classes/sanity.bbclass +0 -0
index c6842ff549..63284b7917 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")

meta/classes/sanity.bbclass +10 -0
+    # Check if PSEUDO_IGNORE_PATHS and ${S} overlap
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS', expand=True).split(",")
+    workdir = d.getVar('WORKDIR')
+    sourcefile = d.getVar('S')
+    if (workdir == sourcefile):
+        for i in pseudoignorepaths:
+            if i and sourcefile:
+                if sourcefile.startswith(i) or i.startswith(sourcefile):
+                    status.addresult("a path included in PSEUDO_IGNORE_PATHS " + str(i) + " and ${S} (source files) path " + str(sourcefile) + " are overlapping each other, please set ${S} in your recipe to point to a different directory. \n")
+
Quoted 3 lines

     # Some third-party software apparently relies on chmod etc. being suid root (!!) import stat
     suid_check_bins = "chown chmod mknod".split()

This isn't quite solving the problem in bug 14193. In that bug lets say:

S = "${WORKDIR}/pack"

and this overlaps with ${WORKDIR}/package (PKGD) and ${WORKDIR}/packages-split (PKGDEST) which are set in package.bbclass.

So the sanity test we need here is to test whether any element of PSEUDO_IGNORE_PATHS overlaps with directories we know need to be under pseudo control. Qi already had a list of these in a different patch:

${D},${PKGD},${PKGDEST},${IMAGE_ROOTFS},${SDK_OUTPUT}

Cheers,

Richard

author
#3 lore raw

Alright, I understand Thanks.
I've added the directories under pseudo control and sent a v3 patch to the list.

Thanks,
Dorinda.

On Jan 30, 2021 12:01, "Richard Purdie" <[email protected]> wrote:

Quoted 1 line · Dorinda

added a sanity check for when PSEUDO_IGNORE_PATHS and ${S} overlap to

avoid random failures generated.

Quoted 16 lines

[YOCTO #14193]

---
v2:
added a condition for when {WORKDIR}={S}

 meta/classes/sanity.bbclass | 10 ++++++++++
 1 file changed, 10 insertions(+)
meta/classes/sanity.bbclass +0 -0
index c6842ff549..63284b7917 100644

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

Quoted 2 lines
meta/classes/sanity.bbclass +0 -0
@@ -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")

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

Quoted 6 lines
meta/classes/sanity.bbclass +2 -0
+    # Check if PSEUDO_IGNORE_PATHS and ${S} overlap
+    pseudoignorepaths = d.getVar('PSEUDO_IGNORE_PATHS',

expand=True).split(",")

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

Quoted 7 lines
meta/classes/sanity.bbclass +7 -0
+    workdir = d.getVar('WORKDIR')
+    sourcefile = d.getVar('S')
+    if (workdir == sourcefile):
+        for i in pseudoignorepaths:
+            if i and sourcefile:
+                if sourcefile.startswith(i) or i.startswith(sourcefile):
+                    status.addresult("a path included in

PSEUDO_IGNORE_PATHS " + str(i) + " and ${S} (source files) path " + str(sourcefile) + " are overlapping each other, please set ${S} in your recipe to point to a different directory. \n")

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

Quoted 2 lines
meta/classes/sanity.bbclass +1 -0
+
     # Some third-party software apparently relies on chmod etc. being

suid root (!!)

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

Quoted 2 lines
meta/classes/sanity.bbclass +0 -0
     import stat
     suid_check_bins = "chown chmod mknod".split()

This isn't quite solving the problem in bug 14193. In that bug lets say:

S = "${WORKDIR}/pack"

and this overlaps with ${WORKDIR}/package (PKGD) and ${WORKDIR}/packages-split (PKGDEST) which are set in package.bbclass.

So the sanity test we need here is to test whether any element of PSEUDO_IGNORE_PATHS overlaps with directories we know need to be under pseudo control. Qi already had a list of these in a different patch:

${D},${PKGD},${PKGDEST},${IMAGE_ROOTFS},${SDK_OUTPUT}

Cheers,

Richard