diff options
| author | Ross Burton <ross.burton@intel.com> | 2017-03-20 16:45:14 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-22 11:35:21 +0000 |
| commit | 3a1e31d7148c1521509fb58ce2013f9b004f2b24 (patch) | |
| tree | e701cfc93d60d746001420facd4f5c37b91dcf02 | |
| parent | fc3ae0cb2aa042c346f5d74692d623e1bc77b7d5 (diff) | |
| download | poky-3a1e31d7148c1521509fb58ce2013f9b004f2b24.tar.gz | |
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.
(From OE-Core rev: a6af5bbf3dad6f0951c67a0aae13ef86a8906893)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/insane.bbclass | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 6a34bd5a94..7a869977e1 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -408,48 +408,6 @@ def package_qa_check_perm(path,name,d, elf, messages): | |||
| 408 | """ | 408 | """ |
| 409 | return | 409 | return |
| 410 | 410 | ||
| 411 | QAPATHTEST[unsafe-references-in-binaries] = "package_qa_check_unsafe_references_in_binaries" | ||
| 412 | def package_qa_check_unsafe_references_in_binaries(path, name, d, elf, messages): | ||
| 413 | """ | ||
| 414 | Ensure binaries in base_[bindir|sbindir|libdir] do not link to files under exec_prefix | ||
| 415 | """ | ||
| 416 | if unsafe_references_skippable(path, name, d): | ||
| 417 | return | ||
| 418 | |||
| 419 | if elf: | ||
| 420 | import subprocess as sub | ||
| 421 | pn = d.getVar('PN') | ||
| 422 | |||
| 423 | exec_prefix = d.getVar('exec_prefix') | ||
| 424 | sysroot_path = d.getVar('STAGING_DIR_TARGET') | ||
| 425 | sysroot_path_usr = sysroot_path + exec_prefix | ||
| 426 | |||
| 427 | try: | ||
| 428 | ldd_output = bb.process.Popen(["prelink-rtld", "--root", sysroot_path, path], stdout=sub.PIPE).stdout.read().decode("utf-8") | ||
| 429 | except bb.process.CmdError: | ||
| 430 | error_msg = pn + ": prelink-rtld aborted when processing %s" % path | ||
| 431 | package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) | ||
| 432 | return False | ||
| 433 | |||
| 434 | if sysroot_path_usr in ldd_output: | ||
| 435 | ldd_output = ldd_output.replace(sysroot_path, "") | ||
| 436 | |||
| 437 | pkgdest = d.getVar('PKGDEST') | ||
| 438 | packages = d.getVar('PACKAGES') | ||
| 439 | |||
| 440 | for package in packages.split(): | ||
| 441 | short_path = path.replace('%s/%s' % (pkgdest, package), "", 1) | ||
| 442 | if (short_path != path): | ||
| 443 | break | ||
| 444 | |||
| 445 | base_err = pn + ": %s, installed in the base_prefix, requires a shared library under exec_prefix (%s)" % (short_path, exec_prefix) | ||
| 446 | for line in ldd_output.split('\n'): | ||
| 447 | if exec_prefix in line: | ||
| 448 | error_msg = "%s: %s" % (base_err, line.strip()) | ||
| 449 | package_qa_handle_error("unsafe-references-in-binaries", error_msg, d) | ||
| 450 | |||
| 451 | return False | ||
| 452 | |||
| 453 | QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" | 411 | QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" |
| 454 | def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): | 412 | def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): |
| 455 | """ | 413 | """ |
