Procházet zdrojové kódy

dpkg-shlibdeps: avoid spurious warnings due to bad parsing of objdump

* scripts/Dpkg/Shlibs/Objdump.pm (parse_dynamic_symbol): Fix the
regular expression to not require two space between alignment and
symbol name.
* scripts/t/200_Dpkg_Shlibs.t,
scripts/t/200_Dpkg_Shlibs/objdump.ls: Add a non-regression test
corresponding to the above case.
Raphael Hertzog před 17 roky
rodič
revize
d26d001729

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2008-11-19  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Shlibs/Objdump.pm (parse_dynamic_symbol): Fix the
+	regular expression to not require two space between alignment and
+	symbol name.
+	* scripts/t/200_Dpkg_Shlibs.t,
+	scripts/t/200_Dpkg_Shlibs/objdump.ls: Add a non-regression test
+	corresponding to the above case.
+
 2008-11-18  Guillem Jover  <guillem@debian.org>
 
 	* configure.ac: Bump version to 1.14.24~.

+ 3 - 1
debian/changelog

@@ -1,6 +1,8 @@
 dpkg (1.14.24) UNRELEASED; urgency=low
 
-  * 
+  [ Raphael Hertzog ]
+  * Fix parsing of objdump output (by dpkg-shlibdeps) in a special case where
+    the symbol name is separated only with a single space. Closes: #506139
 
  -- Guillem Jover <guillem@debian.org>  Tue, 18 Nov 2008 12:40:33 +0200
 

+ 1 - 1
scripts/Dpkg/Shlibs/Objdump.pm

@@ -252,7 +252,7 @@ sub _parse {
 sub parse_dynamic_symbol {
     my ($self, $line) = @_;
     my $vis_re = '(\.protected|\.hidden|\.internal|0x\S+)';
-    if ($line =~ /^[0-9a-f]+ (.{7})\s+(\S+)\s+[0-9a-f]+\s+(\S+)?(?:(?:\s+$vis_re)?\s+(\S+))/) {
+    if ($line =~ /^[0-9a-f]+ (.{7})\s+(\S+)\s+[0-9a-f]+(?:\s+(\S+))?(?:\s+$vis_re)?\s+(\S+)/) {
 
 	my ($flags, $sect, $ver, $vis, $name) = ($1, $2, $3, $4, $5);
 

+ 4 - 1
scripts/t/200_Dpkg_Shlibs.t

@@ -1,6 +1,6 @@
 # -*- mode: cperl;-*-
 
-use Test::More tests => 36;
+use Test::More tests => 37;
 use IO::String;
 
 use strict;
@@ -44,6 +44,9 @@ my $sym = $obj->get_symbol('optarg@GLIBC_2.0');
 ok($sym, 'optarg@GLIBC_2.0 exists');
 ok(!$sym->{'defined'}, 'R_*_COPY relocations are taken into account');
 
+# Non-regression test for #506139
+$sym = $obj->get_symbol('singlespace');
+ok($sym, 'version less symbol separated by a single space are correctly parsed');
 
 open $objdump, '<', "$srcdir/objdump.libc6-2.6"
   or die "$srcdir/objdump.libc6-2.6: $!";

+ 1 - 0
scripts/t/200_Dpkg_Shlibs/objdump.ls

@@ -156,6 +156,7 @@ DYNAMIC SYMBOL TABLE:
 00000000      DF *UND*	00000054  GLIBC_2.0   strcmp
 00000000      DF *UND*	000000fa  GLIBC_2.0   exit
 00000000      DF *UND*	000004bc  ACL_1.0     acl_from_text
+00000000      DF *UND*	00000075 singlespace
 0805bc90 g    D  *ABS*	00000000  Base        _end
 0805b860 g    DO .bss	00000004  GLIBC_2.0   stdout
 0805b82c g    D  *ABS*	00000000  Base        _edata