insane: remove broken unsafe-references-in-binaries test
PATCH 1/2 insane: remove broken unsafe-references-in-binaries test
This test aims to detect binaries in /bin which link to libraries in /usr/lib, for the case where the user has /usr on a separate filesystem to /.
However it doesn't scan both image/ and the sysroot, so if a binary in /bin links to a library in /usr/lib that was built by the same recipe then it will error out.
This test isn't enabled by default, and because of this serious bug I suspect nobody else is enabling it either. As /usr being on a separate partition to / is a very rare configuration these days I think we should delete the test: if someone cares sufficiently they should write a test that actually works.
--- meta/classes/insane.bbclass | 42 ------------------------------------------ 1 file changed, 42 deletions(-)
meta/classes/insane.bbclass +0 -42
@@ -408,48 +408,6 @@ def package_qa_check_perm(path,name,d, elf, messages): """ return -QAPATHTEST[unsafe-references-in-binaries] = "package_qa_check_unsafe_references_in_binaries" -def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages): - """ - Ensure binaries in base_[bindir|sbindir|libdir] do not link to files under exec_prefix - """ - if unsafe_references_skippable(path, name, d): - return - - if elf: - import subprocess as sub - pn = d.getVar('PN') - - exec_prefix = d.getVar('exec_prefix') - sysroot_path = d.getVar('STAGING_DIR_TARGET') - sysroot_path_usr = sysroot_path + exec_prefix - - try: - ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read().decode("utf-8") - except bb.process.CmdError: - error_msg = pn + ": prelink-rtld aborted when processing %s" % path - package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) - return False - - if sysroot_path_usr in ldd_output: - ldd_output = ldd_output.replace(sysroot_path, "") - - pkgdest = d.getVar('PKGDEST') - packages = d.getVar('PACKAGES') - - for package in packages.split(): - short_path = path.replace('%s/%s' % (pkgdest, package), "", 1) - if (short_path != path): - break - - base_err = pn + ": %s, installed in the base_prefix, requires a shared library under exec_prefix (%s)" % (short_path, exec_prefix) - for line in ldd_output.split('\n'): - if exec_prefix in line: - error_msg = "%s: %s" % (base_err, line.strip()) - package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) - - return False - QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): """
Signature · 1 line
2.8.1
PATCH 2/2 oeqa/selftest: remove test_sanity_unsafe_binary_references
This test was attempting to exercise a broken test, for some reason this broke with patches under review but investigation revealed that the test itself is broken. The test has been removed, so there's no need to test it.
--- meta/lib/oeqa/selftest/buildoptions.py | 19 ------------------- 1 file changed, 19 deletions(-)
meta/lib/oeqa/selftest/buildoptions.py +0 -19
@@ -114,25 +114,6 @@ do_install_append_pn-gzip () { line = self.getline(res, "QA Issue: gzip") self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: gzip message is not present in bitbake's output: %s" % res.output) - @testcase(1434) - def test_sanity_unsafe_binary_references(self): - self.write_config('WARN_QA_append = " unsafe-references-in-binaries"') - - #res = bitbake("nfs-utils") - # FIXME when nfs-utils passes this test - #line = self.getline(res, "QA Issue: nfs-utils") - #self.assertFalse(line, "WARNING: QA Issue: nfs-utils message is present in bitbake's output and shouldn't be: %s" % res.output) - -# self.append_config(""" -#do_install_append_pn-nfs-utils () { -# echo "\n${bindir}/test" >> ${D}${base_sbindir}/osd_login -#} -#""") - self.add_command_to_tearDown('bitbake -c clean nfs-utils') - res = bitbake("nfs-utils -f -c package_qa") - line = self.getline(res, "QA Issue: nfs-utils") - self.assertTrue(line and line.startswith("WARNING:"), "WARNING: QA Issue: nfs-utils message is not present in bitbake's output: %s" % res.output) - @testcase(1421) def test_layer_without_git_dir(self): """
Signature · 1 line
2.8.1