]> code.ossystems Code Review - openembedded-core.git/commitdiff
insane: check packages for absolute symlinks to the tmpdir
authorRoss Burton <ross.burton@intel.com>
Mon, 3 Mar 2014 20:23:33 +0000 (20:23 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 7 Mar 2014 14:57:39 +0000 (14:57 +0000)
Add a sanity test that checks for symlinks in packages that point into the
TMPDIR on the host.

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/classes/insane.bbclass

index cf00e12fcec293d30d7d10343ec1a22a7d875495..11c1feb84a2f99e219df8747e5d1e496be31f169 100644 (file)
@@ -574,6 +574,19 @@ def package_qa_check_infodir(path, name, d, elf, messages):
     if infodir in path:
         messages.append("The /usr/share/info/dir file is not meant to be shipped in a particular package.")
 
+QAPATHTEST[symlink-to-sysroot] = "package_qa_check_symlink_to_sysroot"
+def package_qa_check_symlink_to_sysroot(path, name, d, elf, messages):
+    """
+    Check that the package doesn't contain any absolute symlinks to the sysroot.
+    """
+    if os.path.islink(path):
+        target = os.readlink(path)
+        if os.path.isabs(target):
+            tmpdir = d.getVar('TMPDIR', True)
+            if target.startswith(tmpdir):
+                trimmed = path.replace(os.path.join (d.getVar("PKGDEST", True), name), "")
+                messages.append("Symlink %s in %s points to TMPDIR" % (trimmed, name))
+
 def package_qa_check_license(workdir, d):
     """
     Check for changes in the license files