diff options
| author | Ross Burton <ross.burton@intel.com> | 2017-08-08 15:51:18 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-13 09:27:38 +0100 |
| commit | e32bfb80664fd0cd28d3ebd6f0229b9e0a8336c7 (patch) | |
| tree | d614a439e24b0855cc4d9618133b3bf9f62ec3e5 /meta/classes | |
| parent | 7b5e524c8ea071ca244982af28a39dbe94f1fe35 (diff) | |
| download | poky-e32bfb80664fd0cd28d3ebd6f0229b9e0a8336c7.tar.gz | |
insane: remove unsafe-references-in-scripts check
We've already removed unsafe-references-in-binaries (which was fundamentally
broken) and nobody really cares about / and /usr being on different filesystems
anymore (at least if they, they're keeping very quiet and not fixing the bugs).
As this test was a minor detail in the scope of supporting separate / and /usr
which we don't support, it can be removed.
(From OE-Core rev: 5363a5e43462e22ed61e87923e00657b740f6823)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/insane.bbclass | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass index 479d39c67e..022b917a7c 100644 --- a/meta/classes/insane.bbclass +++ b/meta/classes/insane.bbclass | |||
| @@ -390,71 +390,6 @@ def package_qa_check_perm(path,name,d, elf, messages): | |||
| 390 | """ | 390 | """ |
| 391 | return | 391 | return |
| 392 | 392 | ||
| 393 | QAPATHTEST[unsafe-references-in-scripts] = "package_qa_check_unsafe_references_in_scripts" | ||
| 394 | def package_qa_check_unsafe_references_in_scripts(path, name, d, elf, messages): | ||
| 395 | """ | ||
| 396 | Warn if scripts in base_[bindir|sbindir|libdir] reference files under exec_prefix | ||
| 397 | """ | ||
| 398 | if unsafe_references_skippable(path, name, d): | ||
| 399 | return | ||
| 400 | |||
| 401 | if not elf: | ||
| 402 | import stat | ||
| 403 | import subprocess | ||
| 404 | pn = d.getVar('PN') | ||
| 405 | |||
| 406 | # Ensure we're checking an executable script | ||
| 407 | statinfo = os.stat(path) | ||
| 408 | if bool(statinfo.st_mode & stat.S_IXUSR): | ||
| 409 | # grep shell scripts for possible references to /exec_prefix/ | ||
| 410 | exec_prefix = d.getVar('exec_prefix') | ||
| 411 | statement = "grep -e '%s/[^ :]\{1,\}/[^ :]\{1,\}' %s > /dev/null" % (exec_prefix, path) | ||
| 412 | if subprocess.call(statement, shell=True) == 0: | ||
| 413 | error_msg = pn + ": Found a reference to %s/ in %s" % (exec_prefix, path) | ||
| 414 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | ||
| 415 | error_msg = "Shell scripts in base_bindir and base_sbindir should not reference anything in exec_prefix" | ||
| 416 | package_qa_handle_error("unsafe-references-in-scripts", error_msg, d) | ||
| 417 | |||
| 418 | def unsafe_references_skippable(path, name, d): | ||
| 419 | if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d): | ||
| 420 | return True | ||
| 421 | |||
| 422 | if "-dbg" in name or "-dev" in name: | ||
| 423 | return True | ||
| 424 | |||
| 425 | # Other package names to skip: | ||
| 426 | if name.startswith("kernel-module-"): | ||
| 427 | return True | ||
| 428 | |||
| 429 | # Skip symlinks | ||
| 430 | if os.path.islink(path): | ||
| 431 | return True | ||
| 432 | |||
| 433 | # Skip unusual rootfs layouts which make these tests irrelevant | ||
| 434 | exec_prefix = d.getVar('exec_prefix') | ||
| 435 | if exec_prefix == "": | ||
| 436 | return True | ||
| 437 | |||
| 438 | pkgdest = d.getVar('PKGDEST') | ||
| 439 | pkgdest = pkgdest + "/" + name | ||
| 440 | pkgdest = os.path.abspath(pkgdest) | ||
| 441 | base_bindir = pkgdest + d.getVar('base_bindir') | ||
| 442 | base_sbindir = pkgdest + d.getVar('base_sbindir') | ||
| 443 | base_libdir = pkgdest + d.getVar('base_libdir') | ||
| 444 | bindir = pkgdest + d.getVar('bindir') | ||
| 445 | sbindir = pkgdest + d.getVar('sbindir') | ||
| 446 | libdir = pkgdest + d.getVar('libdir') | ||
| 447 | |||
| 448 | if base_bindir == bindir and base_sbindir == sbindir and base_libdir == libdir: | ||
| 449 | return True | ||
| 450 | |||
| 451 | # Skip files not in base_[bindir|sbindir|libdir] | ||
| 452 | path = os.path.abspath(path) | ||
| 453 | if not (base_bindir in path or base_sbindir in path or base_libdir in path): | ||
| 454 | return True | ||
| 455 | |||
| 456 | return False | ||
| 457 | |||
| 458 | QAPATHTEST[arch] = "package_qa_check_arch" | 393 | QAPATHTEST[arch] = "package_qa_check_arch" |
| 459 | def package_qa_check_arch(path,name,d, elf, messages): | 394 | def package_qa_check_arch(path,name,d, elf, messages): |
| 460 | """ | 395 | """ |
