From 4a34d81475596fefea9cfa09b5a7538fbfa57fd3 Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Thu, 27 Sep 2007 00:00:20 +0200 Subject: [PATCH] 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. --- scripts/Dpkg/Shlibs/Objdump.pm | 6 ++++-- scripts/t/200_Dpkg_Shlibs.t | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) 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'); -- 2.39.5