From 2808a791a3de57b928eef067f687b94d3362732d Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Sat, 21 Jun 2008 23:45:43 +0200 Subject: [PATCH] dpkg-shlibdeps uses softer warnings for libraries that are likely plugins * scripts/dpkg-shlibdeps.pl: If the binary analyzed is a library on a non-public path, assume it's likely a plugin and reduce the number of warnings displayed about symbols not found. Also use a different, hopefully less confusing message. * man/dpkg-shlibdeps.1: Document the above changes. --- ChangeLog | 8 ++++++++ debian/changelog | 3 +++ man/dpkg-shlibdeps.1 | 13 +++++++++++++ scripts/dpkg-shlibdeps.pl | 21 +++++++++++++++++---- 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3befd86..2cfe521c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-06-21 Raphael Hertzog + + * scripts/dpkg-shlibdeps.pl: If the binary analyzed is a library on a + non-public path, assume it's likely a plugin and reduce the number of + warnings displayed about symbols not found. Also use a different, + hopefully less confusing message. + * man/dpkg-shlibdeps.1: Document the above changes. + 2008-06-21 Raphael Hertzog * scripts/Dpkg/Vendor.pm: Provide simple parser for vendor-specific diff --git a/debian/changelog b/debian/changelog index dd5d36a0..e4901c55 100644 --- a/debian/changelog +++ b/debian/changelog @@ -43,6 +43,9 @@ dpkg (1.15.0) UNRELEASED; urgency=low change behaviour dynamically depending on the vendor of the current system (or target system when the user overrides DEB_VENDOR by setting it himself). Closes: #457371 + * dpkg-shlibdeps give less strong warnings for symbols not found in NEEDED + libraries when the shared library is a non-public directory and is likely + to be a plugin. Closes: #481165 [ Pierre Habouzit ] * Add a --query option to update-alternatives. Closes: #336091, #441904 diff --git a/man/dpkg-shlibdeps.1 b/man/dpkg-shlibdeps.1 index f9443fcc..7a8f5a65 100644 --- a/man/dpkg-shlibdeps.1 +++ b/man/dpkg-shlibdeps.1 @@ -235,6 +235,19 @@ binary. The \fIbinary\fR is most likely a library and it needs to be linked with an additional library during the build process (option \fB-l\fR\fIlibrary\fR of the linker). .TP +.IB binary " contains an unresolvable reference to symbol " sym ": it's probably a plugin +The indicated symbol has not been found in the libraries linked with the +binary. The \fIbinary\fR is most likely a plugin and the symbol is +probably provided by the program that loads this plugin. In theory a +plugin doesn't have any SONAME but this binary does have one and as such +it could not be clearly identified as such. However the fact that the +binary is stored in a non-public directory is a strong indication +that's it's not a normal shared library. If the binary is really a +plugin, then disregard this warning. But there's always the possibility +that it's a real library and that programs linking to it are using an +RPATH so that the dynamic loader finds it. In that case, the library is +broken and needs to be fixed. +.TP .BI "dependency on " library " could be avoided if " binaries " were not uselessly linked against it (they use none of its symbols)." None of the \fIbinaries\fP that are linked with \fPlibrary\fP use any of the symbols provided by the library. By fixing all the binaries, you would avoid diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index c86b7a75..db42614f 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -6,13 +6,15 @@ use warnings; use English; use POSIX qw(:errno_h :signal_h); use Cwd qw(realpath); +use File::Basename qw(dirname); + use Dpkg; use Dpkg::Gettext; use Dpkg::ErrorHandling qw(warning error failure syserr usageerr); use Dpkg::Path qw(relative_to_pkg_root guess_pkg_root_dir check_files_are_the_same); use Dpkg::Version qw(compare_versions); -use Dpkg::Shlibs qw(find_library); +use Dpkg::Shlibs qw(find_library @librarypaths); use Dpkg::Shlibs::Objdump; use Dpkg::Shlibs::SymbolFile; use Dpkg::Arch qw(get_host_arch); @@ -20,6 +22,7 @@ use Dpkg::Fields qw(capit); use Dpkg::Deps; use Dpkg::Control; + use constant { WARN_SYM_NOT_FOUND => 1, WARN_DEP_AVOIDABLE => 2, @@ -264,6 +267,8 @@ foreach my $file (keys %exec) { # Disable warnings about missing symbols when we have not been able to # find all libs my $disable_warnings = scalar(keys(%soname_notfound)); + my $parent_dir = "/" . dirname(relative_to_pkg_root($file)); + my $in_public_dir = (grep { $parent_dir eq $_ } @librarypaths) ? 1 : 0; foreach my $sym ($obj->get_undefined_dynamic_symbols()) { my $name = $sym->{name}; if ($sym->{version}) { @@ -297,9 +302,17 @@ foreach my $file (keys %exec) { # Drop the default suffix for readability $print_name =~ s/\@Base$//; unless ($sym->{weak}) { - if ($debug or $nb_warnings < 10) { - warning(_g("symbol %s used by %s found in none of the " . - "libraries."), $print_name, $file); + if ($debug or ($in_public_dir and $nb_warnings < 10) + or (!$in_public_dir and $nb_warnings < 1)) + { + if ($in_public_dir) { + warning(_g("symbol %s used by %s found in none of the " . + "libraries."), $print_name, $file); + } else { + warning(_g("%s contains an unresolvable reference to " . + "symbol %s: it's probably a plugin."), + $file, $print_name); + } $nb_warnings++; } else { $nb_skipped_warnings++; -- 2.39.5