Handle ldd $? == 1 in get_reqs()

ldd exits with $? == 1 if a file is 'not a dynamic executable'.
This is correct behaviour of ldd, so we should handle it instead of
raising an exception ;-)

[not in 2.9 and 2.10] Also extend fake_ldd and add a test to test-aa.py to cover this.


Note that 2.10 and 2.9 don't have tests for get_reqs() nor fake_ldd,
so those branches will only get the aa.py changes.


Acked-by: John Johansen <john.johansen@canonical.com> for trunk, 2.10 and 2.9.
This commit is contained in:
Christian Boltz 2016-12-31 00:51:10 +01:00
parent 105dfb2a9d
commit 66280702af

View file

@ -354,9 +354,9 @@ def get_reqs(file):
pattern2 = re.compile('^\s*(\/\S+)')
reqs = []
ret, ldd_out = get_output([ldd, file])
if ret == 0:
if ret == 0 or ret == 1:
for line in ldd_out:
if 'not a dynamic executable' in line:
if 'not a dynamic executable' in line: # comes with ret == 1
break
if 'cannot read header' in line:
break