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

Bug#673451: lintian: improve use of readelf



On Sun, 2012-05-27 at 09:21 +0200, Niels Thykier wrote:
> tags 673451 + moreinfo
> thanks
> 
> 
> On 2012-05-18 20:50, Marc Deslauriers wrote:
> > [...] 
> > 
> > *** /tmp/tmpiekV9j/bug_body
> > In Ubuntu, the attached patch was applied to achieve the following:
> > 
> >   * collection/objdump-info: objdump-info switched from objdump to readelf,
> >     but readelf in Ubuntu doesn't seem to work properly when used with the
> >     -D option, possibly due to differences in default hardening. Work
> >     around issue by using different flags and adjusting parsing. This also
> >     restores version parsing.
> > 
> > Thanks for considering the patch.
> > 
> > [...]
> 
> Hi,
> 
> Thanks for the patch, unfortunately it is causing "uninitialized value"
> warnings in the legacy test suite[1]:

Ah! yes, sorry about that. Here's an updated patch.

Thanks,

Marc.


diff -Naur lintian-2.5.7.old/collection/objdump-info lintian-2.5.7/collection/objdump-info
--- lintian-2.5.7.old/collection/objdump-info	2012-05-13 15:20:39.000000000 -0400
+++ lintian-2.5.7/collection/objdump-info	2012-05-28 13:49:23.549405127 -0400
@@ -142,16 +142,20 @@
             close PIPE;
         }
 
-        if (open(PIPE, '-|', "readelf -W -s -D \Q$bin\E 2>&1")) {
+        if (open(PIPE, '-|', "readelf -W -s \Q$bin\E 2>&1")) {
+            my $section = '';
             print {$opts{pipe_in}} "DYNAMIC SYMBOL TABLE:\n";
 
             while(<PIPE>) {
-                last if m/^Symbol table of/;
-
-                if (m/^\s*(\d+)\s+\d+:\s*[0-9a-f]+\s+\d+\s+(?:(?:\S+\s+){3})(\S+)\s+(.*)\Z/) {
+                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, '');
 
-                    if ($sym =~ m/^(.*)@(.*)$/) {
+                    if ($sym =~ m/^(.*)@(.*) \(.*\)$/) {
                         $sym = $1;
                         $ver = $2;
                     } elsif (@symbol_versions == 0) {

Reply to: