[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.9-17-ge5ee512



The following commit has been merged in the master branch:
commit e5ee512c3da6f49d89895613b0b0fc0db58b009d
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Jun 26 12:11:36 2012 +0200

    coll/objdump-info: Call readelf once per binary
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/collection/objdump-info b/collection/objdump-info
index 92bff6b..4e86481 100755
--- a/collection/objdump-info
+++ b/collection/objdump-info
@@ -66,9 +66,10 @@ foreach my $bin ($info->sorted_index) {
 
         my @sections;
         my @symbol_versions;
+        my @dyn_symbols;
         my $truncated = 0;
 
-        if (open(PIPE, '-|', "readelf -W -l -t -d -V \Q$bin\E 2>&1")) {
+        if (open(PIPE, '-|', "readelf -W -l -t -d -V -s \Q$bin\E 2>&1")) {
             my $section = '';
             my %program_headers;
 
@@ -88,6 +89,10 @@ foreach my $bin ($info->sorted_index) {
                     print {$opts{pipe_in}} "$_\n";
                 } elsif (m/^Version symbols section /) {
                     $section = 'VS';
+                } elsif (m/^Symbol table '.dynsym'/) {
+                    $section = 'DS';
+                } elsif (m/^Symbol table/) {
+                    $section = '';
                 } elsif (m/^\s*$/) {
                     $section = '';
                 } elsif (m/^\s*(\S+)\s*(?:(?:\S+\s+){4})\S+\s(...)/
@@ -131,6 +136,13 @@ foreach my $bin ($info->sorted_index) {
                         }
                         push @symbol_versions, $verstring;
                     }
+                } elsif (m/^\s*(\d+):\s*[0-9a-f]+\s+\d+\s+(?:(?:\S+\s+){3})(\S+)\s+(.*)\Z/
+                         and $section eq 'DS') {
+                    # We (somtimes) need to read the "Version symbols section" first to
+                    # use this data and readelf tends to print after this section, so
+                    # save for later.
+                    push @dyn_symbols, [$1, $2, $3, '']
+
                 } elsif (m/^There is no dynamic section in this file/
                          and exists $program_headers{DYNAMIC}) {
                     # The headers declare a dynamic section but it's
@@ -142,18 +154,10 @@ foreach my $bin ($info->sorted_index) {
             close PIPE;
         }
 
-        if (open(PIPE, '-|', "readelf -W -s \Q$bin\E 2>&1")) {
-            my $section = '';
+        if (@dyn_symbols) {
             print {$opts{pipe_in}} "DYNAMIC SYMBOL TABLE:\n";
-
-            while(<PIPE>) {
-                if (m/^Symbol table '.dynsym'/) {
-                    $section = 'DS';
-                } elsif (m/^Symbol table/) {
-                    $section = '';
-                } elsif (m/^\s*(\d+):\s*[0-9a-f]+\s+\d+\s+(?:(?:\S+\s+){3})(\S+)\s+(.*)\Z/
-                         and $section eq 'DS') {
-                    my ($symnum, $seg, $sym, $ver) = ($1, $2, $3, '');
+            foreach my $dynsym (@dyn_symbols) {
+                my ($symnum, $seg, $sym, $ver) = @$dynsym;
 
                     if ($sym =~ m/^(.*)@(.*) \(.*\)$/) {
                         $sym = $1;
@@ -180,10 +184,7 @@ foreach my $bin ($info->sorted_index) {
                     }
 
                     print {$opts{pipe_in}} "00      XX $seg  000000  $ver  $sym\n";
-                }
             }
-
-            close PIPE;
         }
     }
 }
diff --git a/debian/changelog b/debian/changelog
index 83a5848..27b6c4e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,8 @@ lintian (2.5.10) UNRELEASED; urgency=low
       extract information from Jar files.
     + [NT] Limit java-info to files classified as "Zip Archive"
       by file(1).
+  * collection/objdump-info:
+    + [NT] Only call readelf once per binary.
 
   * debian/control:
     + [NT] Add (Build-)Dependency on libarchive-zip-perl.

-- 
Debian package checker


Reply to: