Procházet zdrojové kódy

dpkg-shlibdeps: accounts usage of symbols of libraries without SONAME

* scripts/Dpkg/Shlibs/Objdump.pm: Add "objid" property to
symbols and fake "soname" property with the basename of the
object's filename if the object has no official SONAME.
* scripts/dpkg-shlibdeps.pl: Add some more debugging messages.
* scripts/dpkg-shlibdeps.pl: Also count usage of alternate sonames
for symbols found in symbols files.
Raphael Hertzog před 18 roky
rodič
revize
cee53c8f75
4 změnil soubory, kde provedl 24 přidání a 4 odebrání
  1. 9 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 2 1
      scripts/Dpkg/Shlibs/Objdump.pm
  4. 11 3
      scripts/dpkg-shlibdeps.pl

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+2008-03-16  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Shlibs/Objdump.pm: Add "objid" property to
+	symbols and fake "soname" property with the basename of the
+	object's filename if the object has no official SONAME.
+	* scripts/dpkg-shlibdeps.pl: Add some more debugging messages.
+	* scripts/dpkg-shlibdeps.pl: Also count usage of alternate sonames
+	for symbols found in symbols files.
+
 2008-03-16  Guillem Jover  <guillem@debian.org>
 2008-03-16  Guillem Jover  <guillem@debian.org>
 
 
 	* configure.ac (AC_CHECK_HEADERS): Add 'libintl.h'.
 	* configure.ac (AC_CHECK_HEADERS): Add 'libintl.h'.

+ 2 - 0
debian/changelog

@@ -67,6 +67,8 @@ dpkg (1.14.17) UNRELEASED; urgency=low
     must be discarded due to another dependency appearing further
     must be discarded due to another dependency appearing further
     in the field, the superseding dependency will take the place of the
     in the field, the superseding dependency will take the place of the
     discarded one. Added a test case for this.
     discarded one. Added a test case for this.
+  * dpkg-shlibdeps properly accounts usage of symbols provided by private
+    libraries without SONAME. Closes: #469838
 
 
   [ Frank Lichtenheld ]
   [ Frank Lichtenheld ]
   * Add a warning in dpkg-buildpackage if the build-dependencies are not
   * Add a warning in dpkg-buildpackage if the build-dependencies are not

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

@@ -315,7 +315,8 @@ sub apply_relocations {
 
 
 sub add_dynamic_symbol {
 sub add_dynamic_symbol {
     my ($self, $symbol) = @_;
     my ($self, $symbol) = @_;
-    $symbol->{soname} = $self->{SONAME};
+    $symbol->{objid} = $symbol->{soname} = $self->get_id();
+    $symbol->{soname} =~ s{^.*/}{} unless $self->{SONAME};
     if ($symbol->{version}) {
     if ($symbol->{version}) {
 	$self->{dynsyms}{$symbol->{name} . '@' . $symbol->{version}} = $symbol;
 	$self->{dynsyms}{$symbol->{name} . '@' . $symbol->{version}} = $symbol;
     } else {
     } else {

+ 11 - 3
scripts/dpkg-shlibdeps.pl

@@ -85,7 +85,7 @@ foreach (@ARGV) {
     } elsif (m/^-t(.*)$/) {
     } elsif (m/^-t(.*)$/) {
 	$packagetype = $1;
 	$packagetype = $1;
     } elsif (m/^-v$/) {
     } elsif (m/^-v$/) {
-	$debug = 1;
+	$debug++;
     } elsif (m/^-x(.*)$/) {
     } elsif (m/^-x(.*)$/) {
 	push @exclude, $1;
 	push @exclude, $1;
     } elsif (m/^-/) {
     } elsif (m/^-/) {
@@ -116,7 +116,7 @@ my %shlibs;
 my $cur_field;
 my $cur_field;
 foreach my $file (keys %exec) {
 foreach my $file (keys %exec) {
     $cur_field = $exec{$file};
     $cur_field = $exec{$file};
-    print "Scanning $file (for $cur_field field)\n" if $debug;
+    print ">> Scanning $file (for $cur_field field)\n" if $debug;
 
 
     my $obj = Dpkg::Shlibs::Objdump::Object->new($file);
     my $obj = Dpkg::Shlibs::Objdump::Object->new($file);
     my @sonames = $obj->get_needed_libraries;
     my @sonames = $obj->get_needed_libraries;
@@ -195,7 +195,7 @@ foreach my $file (keys %exec) {
 	    } else {
 	    } else {
 		# No symbol file found, fall back to standard shlibs
 		# No symbol file found, fall back to standard shlibs
 		my $id = $dumplibs_wo_symfile->parse($lib);
 		my $id = $dumplibs_wo_symfile->parse($lib);
-		if ($id ne $soname) {
+		if (($id ne $soname) and ($id ne $lib)) {
 		    warning(_g("%s has an unexpected SONAME (%s)"), $lib, $id);
 		    warning(_g("%s has an unexpected SONAME (%s)"), $lib, $id);
 		    $alt_soname{$id} = $soname;
 		    $alt_soname{$id} = $soname;
 		}
 		}
@@ -241,14 +241,21 @@ foreach my $file (keys %exec) {
 	} else {
 	} else {
 	    $name .= "\@Base";
 	    $name .= "\@Base";
 	}
 	}
+        print " Looking up symbol $name\n" if $debug > 1;
 	my $symdep = $symfile->lookup_symbol($name, \@sonames);
 	my $symdep = $symfile->lookup_symbol($name, \@sonames);
 	if (defined($symdep)) {
 	if (defined($symdep)) {
+            print " Found in symbols file of $symdep->{soname}\n" if $debug > 1;
 	    $used_sonames{$symdep->{soname}}++;
 	    $used_sonames{$symdep->{soname}}++;
+            if (exists $alt_soname{$symdep->{soname}}) {
+                # Also count usage on alternate soname
+                $used_sonames{$alt_soname{$symdep->{soname}}}++;
+            }
 	    update_dependency_version($symdep->{depends},
 	    update_dependency_version($symdep->{depends},
 				      $symdep->{minver});
 				      $symdep->{minver});
 	} else {
 	} else {
 	    my $syminfo = $dumplibs_wo_symfile->locate_symbol($name);
 	    my $syminfo = $dumplibs_wo_symfile->locate_symbol($name);
 	    if (not defined($syminfo)) {
 	    if (not defined($syminfo)) {
+                print " Not found\n" if $debug > 1;
 		next if $disable_warnings;
 		next if $disable_warnings;
 		# Complain about missing symbols only for executables
 		# Complain about missing symbols only for executables
 		# and public libraries
 		# and public libraries
@@ -267,6 +274,7 @@ foreach my $file (keys %exec) {
 		    }
 		    }
 		}
 		}
 	    } else {
 	    } else {
+                print " Found in $syminfo->{soname} ($syminfo->{objid})\n" if $debug > 1;
 		if (exists $alt_soname{$syminfo->{soname}}) {
 		if (exists $alt_soname{$syminfo->{soname}}) {
 		    # Also count usage on alternate soname
 		    # Also count usage on alternate soname
 		    $used_sonames{$alt_soname{$syminfo->{soname}}}++;
 		    $used_sonames{$alt_soname{$syminfo->{soname}}}++;