[OE-core] [CONSOLIDATED PULL 19/26] insane.bbclass: add QA tests for unsafe references to exec_prefix

Scott Garman scott.a.garman at intel.com
Thu Dec 22 16:16:16 UTC 2011


On 12/22/2011 01:02 AM, Phil Blundell wrote:
> On Wed, 2011-12-21 at 23:55 -0800, Saul Wold wrote:
>> +		exec_prefix = d.getVar('exec_prefix', True)
>> +		sysroot_path = d.getVar('STAGING_DIR_TARGET', True)
>> +		sysroot_path_usr = sysroot_path + exec_prefix
>> +
>> +		try:
>> +			ldd_output = sub.check_output(["prelink-rtld", "--root", sysroot_path, path])
>> +		except sub.CalledProcessError as e:
>> +			if e.returncode != 127:
>> +				error_msg = pn + ": prelink-rtld aborted when processing %s" % path
>> +				package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
>> +				return False
>> +			else:
>> +				# Sometimes this is done deliberately (e.g, e2fsprogs), so only warn
>> +				bb.warn("%s has missing library dependencies" % path)
>> +				return
>> +		if sysroot_path_usr in ldd_output:
>> +			error_msg = pn + ": %s links to something under exec_prefix" % path
>> +			package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
>> +			error_msg = "ldd reports: %s" % ldd_output
>> +			package_qa_handle_error("unsafe-references-in-binaries", error_msg, d)
>> +			return False
>
> Is that going to do the right thing if ${prefix} == ${exec_prefix}?
> It's not obvious to me that it will handle that case correctly.

The function unsafe_references_skippable checks if exec_prefix == "" and 
also if base_bindir == bindir and base_sbindir == sbindir and 
base_libdir == libdir. Would that cover this case, or should this check 
be made explicit?

Scott

-- 
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center




More information about the Openembedded-core mailing list