Skip to contentSkip to conversation

sudo: Ignore hardcoded home paths in QA

PATCH New Mathieu Dubois-Briand 1 participant 3 messages Aug 14

lore
Share & tools
lore
#0 lore raw

cover sudo: Ignore hardcoded home paths in QA

The changelog contains the "/home/buildroot/autobuild/" string: ignore it in QA. This needs to evolve a bit how OEQA_BUILDPATHS_SKIP is handled.

---
Mathieu Dubois-Briand (2):
classes/insane: improve HOME checks exceptions
sudo: Ignore hardcoded home paths in QA

 meta/classes-global/insane.bbclass  | 3 ++-
 meta/recipes-extended/sudo/sudo.inc | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

---
base-commit: dd003e147db548d9c86821a08450d6461d061cea
change-id: 20260814-mathieu-sudo-home-1260073b5077

Best regards,

Signature · 1 line
Mathieu Dubois-Briand <[email protected]>
#1 lore raw

PATCH 1/2 classes/insane: improve HOME checks exceptions

Allow buildpath HOME checks exceptions to match for substrings.

E.g. if the recipe source code contains "/home/buildroot", the QA check will also trigger when the home folder is "/home/build". So adding "/home/buildroot" in OEQA_BUILDPATHS_SKIP should also ignore "/home/build".

---
 meta/classes-global/insane.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/classes-global/insane.bbclass +2 -1
index c0868849fbe0..a4d17ccd2ad6 100644
@@ -437,12 +437,13 @@ def package_qa_check_buildpaths(path, name, d, elf):
 
     tmpdir = bytes(d.getVar('TMPDIR'), encoding="utf-8")
     homedir = bytes(os.environ.get('HOME', ''), encoding="utf-8")
+    buildpaths_skip = (d.getVar("OEQA_BUILDPATHS_SKIP") or "").split()
     with open(path, 'rb') as f:
         file_content = f.read()
         if tmpdir in file_content:
             path = package_qa_clean_path(path, d, name)
             oe.qa.handle_error("buildpaths", "File %s in package %s contains reference to TMPDIR" % (path, name), d)
-        if homedir and homedir in file_content and not homedir.decode() in (d.getVar("OEQA_BUILDPATHS_SKIP") or "").split():
+        if homedir and homedir in file_content and not any(path.startswith(homedir.decode()) for path in buildpaths_skip):
             path = package_qa_clean_path(path, d, name)
             oe.qa.handle_error("buildpaths", "File %s in package %s contains a reference to the build host HOME directory. If upstream hardcodes a directory path that matches your home, you can set OEQA_BUILDPATHS_SKIP = \"%s\" in the recipe." % (path, name, homedir.decode()), d)
 
Signature · 1 line
2.47.3
#2 lore raw

PATCH 2/2 sudo: Ignore hardcoded home paths in QA

In reply to Mathieu Dubois-Briand

The changelog contains the "/home/buildroot/autobuild/" string.

---
 meta/recipes-extended/sudo/sudo.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-extended/sudo/sudo.inc +1 -0
index e46934171810..05cae03a36ae 100644
@@ -48,3 +48,4 @@ do_install:prepend (){
 }
 
 CVE_VERSION_SUFFIX = "patch"
+OEQA_BUILDPATHS_SKIP = "/home/buildroot"
Signature · 1 line
2.47.3