From: Raphael Hertzog Date: Wed, 26 Sep 2007 22:00:20 +0000 (+0200) Subject: Bugfix in Dpkg::Shlibs::Objdump parsing of flags returned by objdump -f X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a34d81475596fefea9cfa09b5a7538fbfa57fd3;p=dpkg Bugfix in Dpkg::Shlibs::Objdump parsing of flags returned by objdump -f The parser was not working as expected due to a wrong regexp. Added a non-regression test case to avoid this in the future. --- diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm index 97526bf9..cbe8041d 100644 --- a/scripts/Dpkg/Shlibs/Objdump.pm +++ b/scripts/Dpkg/Shlibs/Objdump.pm @@ -190,12 +190,14 @@ sub _parse { } elsif ($section eq "none") { if (/^\s*\S+:\s*file\s+format\s+(\S+)\s*$/) { $self->{format} = $1; - } elsif (/^architecture:\s*\S+,\s*flags:\s*\S+\s*$/) { + } elsif (/^architecture:\s*\S+,\s*flags\s*\S+:\s*$/) { # Parse 2 lines of "-f" # architecture: i386, flags 0x00000112: # EXEC_P, HAS_SYMS, D_PAGED # start address 0x08049b50 - $self->{flags}{$_} = 1 foreach (split(/,\s*/, <$fh>)); + $_ = <$fh>; + chomp; + $self->{flags}{$_} = 1 foreach (split(/,\s*/)); } } } diff --git a/scripts/t/200_Dpkg_Shlibs.t b/scripts/t/200_Dpkg_Shlibs.t index b2e3fef7..1163fdc3 100644 --- a/scripts/t/200_Dpkg_Shlibs.t +++ b/scripts/t/200_Dpkg_Shlibs.t @@ -1,6 +1,6 @@ # -*- mode: cperl;-*- -use Test::More tests => 26; +use Test::More tests => 27; use strict; use warnings; @@ -30,6 +30,7 @@ is($obj->{SONAME}, 'libc.so.6', 'SONAME'); is($obj->{HASH}, '0x13d99c', 'HASH'); is($obj->{GNU_HASH}, '0x194', 'GNU_HASH'); is($obj->{format}, 'elf32-i386', 'format'); +is_deeply($obj->{flags}, { DYNAMIC => 1, HAS_SYMS => 1, D_PAGED => 1 }, 'flags'); is_deeply($obj->{NEEDED}, [ 'ld-linux.so.2' ], 'NEEDED'); is_deeply([ $obj->get_needed_libraries ], [ 'ld-linux.so.2' ], 'NEEDED');