The branch, master has been updated
       via  deaf2e577ca577e89fc2afa31a7d771f310ef246 (commit)
       via  023999f80eb086b3dd9222af3564c2a1bfae0b48 (commit)
      from  ef169716b64598385a978e17c5c8a8e1d64c8877 (commit)


- Shortlog ------------------------------------------------------------
deaf2e5 dpkg-shlibdeps.pl: doesn't warn any more about libm.so.6 being unused
023999f Dpkg::Shlibs::find_library() tries harder to return the canonical name

Summary of changes:
 ChangeLog                 |   15 +++++++++++
 debian/changelog          |    8 ++++++
 scripts/Dpkg/Path.pm      |   60 ++++++++++++++++++++++++++++++++++++++++++++-
 scripts/Dpkg/Shlibs.pm    |   18 +++++++++++--
 scripts/dpkg-shlibdeps.pl |    3 ++
 5 files changed, 100 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
Details of changes:

commit deaf2e577ca577e89fc2afa31a7d771f310ef246
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date:   Sat Dec 8 21:50:28 2007 +0100

    dpkg-shlibdeps.pl: doesn't warn any more about libm.so.6 being unused
    
    If the binary is also linked against libstdc++, the warning is suppressed
    since g++ always add an implicit -lm.

diff --git a/ChangeLog b/ChangeLog
index b3fb147..ff9e850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2007-12-08  Raphael Hertzog  <[EMAIL PROTECTED]>
 
+       * scripts/dpkg-shlibdeps.pl: Doesn't warn any more about libm.so.6
+       being unused if the binary is also linked against libstdc++ since
+       g++ always add an implicit -lm.
+
+2007-12-08  Raphael Hertzog  <[EMAIL PROTECTED]>
+
        * scripts/Dpkg/Shlibs.pm (find_library): When it finds a library
        in a directory which is just a symlink to another directory that
        is also considered, remember the other directory name as the
diff --git a/debian/changelog b/debian/changelog
index aa336b2..54d55a3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,9 @@ dpkg (1.14.13) UNRELEASED; urgency=low
   * When dpkg-shlibdeps finds a lib in a directory which is just a symlink to
     another directory that is also considered, remember the other directory
     name as the canonical one. Closes: #453885
+  * dpkg-shlibdeps doesn't warn any more about libm.so.6 being unused if the
+    binary is also linked against libstdc++ since g++ always add an implicit
+    -lm. Closes: #454616
 
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index ad88e7e..c26b7a3 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -255,6 +255,9 @@ foreach my $file (keys %exec) {
     # Warn about un-NEEDED libraries
     foreach my $soname (@sonames) {
        unless ($soname_notfound{$soname} or $used_sonames{$soname}) {
+           # Ignore warning for libm.so.6 if also linked against libstdc++
+           next if ($soname =~ /^libm\.so\.\d+$/ and
+                    scalar grep(/^libstdc\+\+\.so\.\d+/, @sonames));
            warning(_g("%s shouldn't be linked with %s (it uses none of its " .
                       "symbols)."), $file, $soname);
        }

commit 023999f80eb086b3dd9222af3564c2a1bfae0b48
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date:   Sat Dec 8 21:33:09 2007 +0100

    Dpkg::Shlibs::find_library() tries harder to return the canonical name
    
    When it finds a library in a directory which is just a symlink to another
    directory that is also considered, remember the other directory name as
    the canonical one. And uses the new canonpath() to also simplify path
    names containing "/../".

diff --git a/ChangeLog b/ChangeLog
index ea2f691..b3fb147 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-12-08  Raphael Hertzog  <[EMAIL PROTECTED]>
+
+       * scripts/Dpkg/Shlibs.pm (find_library): When it finds a library
+       in a directory which is just a symlink to another directory that
+       is also considered, remember the other directory name as the
+       canonical one.
+       * scripts/Dpkg/Path.pm: Add new function canonpath() and
+       resolve_symlink().
+
 2007-12-05  Frank Lichtenheld  <[EMAIL PROTECTED]>
 
        * scripts/dpkg-buildpackage.pl: Add new
diff --git a/debian/changelog b/debian/changelog
index 66b2130..aa336b2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,11 @@ dpkg (1.14.13) UNRELEASED; urgency=low
     Closes: #109794, #200454
   * Bump Standards-Version to 3.7.3 (no changes)
 
+  [ Raphael Hertzog ]
+  * When dpkg-shlibdeps finds a lib in a directory which is just a symlink to
+    another directory that is also considered, remember the other directory
+    name as the canonical one. Closes: #453885
+
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)
 
diff --git a/scripts/Dpkg/Path.pm b/scripts/Dpkg/Path.pm
index 93518e8..30c7de9 100644
--- a/scripts/Dpkg/Path.pm
+++ b/scripts/Dpkg/Path.pm
@@ -20,10 +20,12 @@ use strict;
 use warnings;
 
 use Exporter;
+use File::Spec;
 use Cwd qw(realpath);
 our @ISA = qw(Exporter);
 our @EXPORT_OK = qw(get_pkg_root_dir relative_to_pkg_root
-                   guess_pkg_root_dir check_files_are_the_same);
+                   guess_pkg_root_dir check_files_are_the_same
+                   resolve_symlink canonpath);
 
 =head1 NAME
 
@@ -119,6 +121,62 @@ sub check_files_are_the_same($$) {
     return $result;
 }
 
+
+=item canonpath($file)
+
+This function returns a cleaned path. It simplifies double //, and remove
+/./ and /../ intelligently. For /../ it simplifies the path only if the
+previous element is not a symlink. Thus it should only be used on real
+filenames.
+
+=cut
+sub canonpath($) {
+    my $path = shift;
+    $path = File::Spec->canonpath($path);
+    my ($v, $dirs, $file) = File::Spec->splitpath($path);
+    my @dirs = File::Spec->splitdir($dirs);
+    my @new;
+    foreach my $d (@dirs) {
+       if ($d eq '..') {
+           if (scalar(@new) > 0 and $new[-1] ne "..") {
+               next if $new[-1] eq ""; # Root directory has no parent
+               my $parent = File::Spec->catpath($v,
+                       File::Spec->catdir(@new), '');
+               if (not -l $parent) {
+                   pop @new;
+               } else {
+                   push @new, $d;
+               }
+           } else {
+               push @new, $d;
+           }
+       } else {
+           push @new, $d;
+       }
+    }
+    return File::Spec->catpath($v, File::Spec->catdir(@new), $file);
+}
+
+=item $newpath = resolve_symlink($symlink)
+
+Return the filename of the file pointed by the symlink. The new name is
+canonicalized by canonpath().
+
+=cut
+sub resolve_symlink($) {
+    my $symlink = shift;
+    my $content = readlink($symlink);
+    return undef unless defined $content;
+    if (File::Spec->file_name_is_absolute($content)) {
+       return canonpath($content);
+    } else {
+       my ($link_v, $link_d, $link_f) = File::Spec->splitpath($symlink);
+       my ($cont_v, $cont_d, $cont_f) = File::Spec->splitpath($content);
+       my $new = File::Spec->catpath($link_v, $link_d . "/" . $cont_d, 
$cont_f);
+       return canonpath($new);
+    }
+}
+
 =back
 
 =head1 AUTHOR
diff --git a/scripts/Dpkg/Shlibs.pm b/scripts/Dpkg/Shlibs.pm
index 247ddcf..3d20e13 100644
--- a/scripts/Dpkg/Shlibs.pm
+++ b/scripts/Dpkg/Shlibs.pm
@@ -27,6 +27,7 @@ use File::Spec;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(syserr);
 use Dpkg::Shlibs::Objdump;
+use Dpkg::Path qw(resolve_symlink canonpath);
 
 use constant DEFAULT_LIBRARY_PATH =>
     qw(/lib /usr/lib /lib32 /usr/lib32 /lib64 /usr/lib64
@@ -77,10 +78,21 @@ sub find_library {
     $root =~ s{/+$}{};
     my @rpath = @{$rpath};
     foreach my $dir (@rpath, @librarypaths) {
-       if (-e "$root$dir/$lib") {
-           my $libformat = Dpkg::Shlibs::Objdump::get_format("$root$dir/$lib");
+       my $checkdir = "$root$dir";
+       # If the directory checked is a symlink, check if it doesn't
+       # resolve to another public directory (which is then the canonical
+       # directory to use instead of this one). Typical example
+       # is /usr/lib64 -> /usr/lib on amd64.
+       if (-l $checkdir) {
+           my $newdir = resolve_symlink($checkdir);
+           if (grep { "$root$_" eq "$newdir" } (@rpath, @librarypaths)) {
+               $checkdir = $newdir;
+           }
+       }
+       if (-e "$checkdir/$lib") {
+           my $libformat = Dpkg::Shlibs::Objdump::get_format("$checkdir/$lib");
            if ($format eq $libformat) {
-               return File::Spec->canonpath("$root$dir/$lib");
+               return canonpath("$checkdir/$lib");
            }
        }
     }

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to