[lintian] 01/01: helpers/c/objdump-info: Handle .a files containing poems
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit cb866f69aa54ba3ebfc9faf9b4278ec7f1492ab4
Author: Niels Thykier <niels@thykier.net>
Date: Wed Jul 1 20:32:51 2015 +0200
helpers/c/objdump-info: Handle .a files containing poems
Signed-off-by: Niels Thykier <niels@thykier.net>
---
debian/changelog | 4 ++++
helpers/coll/objdump-info-helper | 17 ++++++++++++++++-
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 10742a7..5d77e07 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,10 @@ lintian (2.5.33) UNRELEASED; urgency=medium
* helpers/coll/objdump-info-helper:
+ [NT] Fix use of undefined variable in some cases.
+ + [JW,NT] Gracefully cope with upstreams storing poems in
+ valid ar archives with the file extension ".a" and
+ possibly also corrupt ar files.
+ (Closes: #790493)
* reporting/templates/*.tmpl:
+ [NT] Change from XHTML 1.1 to HTML5.
diff --git a/helpers/coll/objdump-info-helper b/helpers/coll/objdump-info-helper
index fea0e42..4a7a063 100755
--- a/helpers/coll/objdump-info-helper
+++ b/helpers/coll/objdump-info-helper
@@ -44,6 +44,7 @@ my $section = '';
# then we have to escape the args and that puts us over the
# argument limit in some cases...
my $pid = open(my $readelf, '-|');
+my $static_lib_issues = 0;
if (not $pid) {
# child - re-direct standerr and exec
@@ -108,6 +109,13 @@ while (my $line = <$readelf>) {
# multiple errors per file, hench the "unless".
print "Broken: yes\n" unless $truncated++;
next;
+ } elsif ($line =~ m/^readelf: Error: Not an ELF file/) {
+ # Some upstreams like to create valid ar archives with the ".a"
+ # extensions and fill them with poems rather than object files.
+ #
+ # Possibly a reference to afl...
+ $static_lib_issues++ if $bin =~ m{\([^/\\)]++\)$};
+ next;
} elsif ($line =~ m/^Program Headers:/) {
$section = 'PH';
print "Program-Headers:\n";
@@ -202,7 +210,14 @@ while (my $line = <$readelf>) {
# Finish the last file
finish_file();
-close($readelf);
+eval {
+ close($readelf);
+};
+if (my $err = $@) {
+ if ($static_lib_issues == 0) {
+ die($err);
+ }
+}
exit 0;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: