Просмотр исходного кода

dpkg-shlibdeps: Always try the realpath of the lib as fallback to identify the associated package

* scripts/dpkg-shlibdeps.pl (find_packages): Make sure to always
  return [''] for a miss in the 'dpkg -S' query.
* scripts/dpkg-shlibdeps.pl: Always try the realpath($lib) as
  fallback to identify the package (even if it's not a symlink)
  because due to broken RPATH we might get library filenames such as
  "/usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/libssl.so.9.8"
  which is not a symlink and which can still be simplified to
  "/usr/lib/libssl.so.9.8" with realpath().
Raphael Hertzog лет назад: 18
Родитель
Сommit
5d139acefc
3 измененных файлов с 21 добавлено и 5 удалено
  1. 11 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 8 5
      scripts/dpkg-shlibdeps.pl

+ 11 - 0
ChangeLog

@@ -1,3 +1,14 @@
+2007-11-28  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl (find_packages): Make sure to always
+	return [''] for a miss in the 'dpkg -S' query.
+	* scripts/dpkg-shlibdeps.pl: Always try the realpath($lib) as
+	fallback to identify the package (even if it's not a symlink)
+	because due to broken RPATH we might get library filenames such as
+	"/usr/lib/gcc/i486-linux-gnu/4.2.3/../../../../lib/libssl.so.9.8"
+	which is not a symlink and which can still be simplified to
+	"/usr/lib/libssl.so.9.8" with realpath().
+
 2007-11-25  Raphael Hertzog  <hertzog@debian.org>
 2007-11-25  Raphael Hertzog  <hertzog@debian.org>
 
 
 	* scripts/Dpkg/Shlibs.pm (find_library): Canonicalize paths before
 	* scripts/Dpkg/Shlibs.pm (find_library): Canonicalize paths before

+ 2 - 0
debian/changelog

@@ -4,6 +4,8 @@ dpkg (1.14.12) UNRELEASED; urgency=low
   * Add -I<file> option to dpkg-gensymbols to force the usage of a specific
   * Add -I<file> option to dpkg-gensymbols to force the usage of a specific
     symbols file.
     symbols file.
   * Dpkg::Shlibs::find_library() now returns canonicalized paths.
   * Dpkg::Shlibs::find_library() now returns canonicalized paths.
+  * dpkg-shlibdeps always tries the realpath() of a lib as fallback when
+    trying to identify the package of a lib (and not only for symlinks).
 
 
  -- Guillem Jover <guillem@debian.org>  Sat, 24 Nov 2007 07:38:13 +0200
  -- Guillem Jover <guillem@debian.org>  Sat, 24 Nov 2007 07:38:13 +0200
 
 

+ 8 - 5
scripts/dpkg-shlibdeps.pl

@@ -103,8 +103,9 @@ foreach my $file (keys %exec) {
 	           "'shlibs' files are looked into)."), $soname)
 	           "'shlibs' files are looked into)."), $soname)
 	    unless defined($lib);
 	    unless defined($lib);
 	$libfiles{$lib} = $soname;
 	$libfiles{$lib} = $soname;
-	if (-l $lib) {
-	    $altlibfiles{realpath($lib)} = $soname;
+	my $reallib = realpath($lib);
+	if ($reallib ne $lib) {
+	    $altlibfiles{$reallib} = $soname;
 	}
 	}
 	print "Library $soname found in $lib\n" if $debug;
 	print "Library $soname found in $lib\n" if $debug;
     }
     }
@@ -114,15 +115,16 @@ foreach my $file (keys %exec) {
     my @soname_wo_symfile;
     my @soname_wo_symfile;
     foreach my $lib (keys %libfiles) {
     foreach my $lib (keys %libfiles) {
 	my $soname = $libfiles{$lib};
 	my $soname = $libfiles{$lib};
-	if (not exists $file2pkg->{$lib} and -l $lib) {
-	    # If the lib found is an unpackaged symlink, we try a fallback
+	if (not scalar(grep { $_ ne '' } @{$file2pkg->{$lib}})) {
+	    # The path of the library as calculated is not the
+	    # official path of a packaged file, try to fallback on
 	    # on the realpath() first, maybe this one is part of a package
 	    # on the realpath() first, maybe this one is part of a package
 	    my $reallib = realpath($lib);
 	    my $reallib = realpath($lib);
 	    if (exists $file2pkg->{$reallib}) {
 	    if (exists $file2pkg->{$reallib}) {
 		$file2pkg->{$lib} = $file2pkg->{$reallib};
 		$file2pkg->{$lib} = $file2pkg->{$reallib};
 	    }
 	    }
 	}
 	}
-	if (not exists $file2pkg->{$lib}) {
+	if (not scalar(grep { $_ ne '' } @{$file2pkg->{$lib}})) {
 	    # If the library is really not available in an installed package,
 	    # If the library is really not available in an installed package,
 	    # it's because it's in the process of being built
 	    # it's because it's in the process of being built
 	    # Empty package name will lead to consideration of symbols
 	    # Empty package name will lead to consideration of symbols
@@ -529,6 +531,7 @@ sub find_packages {
 	} else {
 	} else {
 	    push @files, $_;
 	    push @files, $_;
 	    $cached_pkgmatch{$_} = [""]; # placeholder to cache misses too.
 	    $cached_pkgmatch{$_} = [""]; # placeholder to cache misses too.
+	    $pkgmatch->{$_} = [""];        # might be replaced later on
 	}
 	}
     }
     }
     return $pkgmatch unless scalar(@files);
     return $pkgmatch unless scalar(@files);