Control: severity -1 wishlist

[ Lowering as there seems to be a workaround, and this involves
  multilib, which I consider in general unsupportable. ]

Hi!

On Thu, 2016-04-14 at 19:40:52 +0200, Sven Joachim wrote:
> Package: dpkg-dev
> Version: 1.18.4
> Severity: important
> User: [email protected]
> Usertags: dpkg-shlibdeps
> 
> When working on a prospective libtinfo5-udeb package (see #819397) we
> discovered that on architectures which build ncurses multilib libraries,
> the libtinfo5-udeb packages gains a bogus dependency on lib32tinfo5 or
> lib64tinfo5, respectively.  This is the relevant output of
> "dh_shlibdeps -s -- -v" on i386:

Buh, multilib. :(

> ,----
> | >> Scanning debian/libtinfo5-udeb/lib/libtic.so.5.9 (for Depends field)
> | Library libc.so.6 found in /lib/i386-linux-gnu/libc.so.6
> | Library libtinfo.so.5 found in debian/libtinfo5-udeb/lib/libtinfo.so.5
> | Using shlibs+objdump for libc.so.6 (file /lib/i386-linux-gnu/libc.so.6)
> |  Looking up shlibs dependency of libc.so.6 provided by 'libc6:i386'
> |  Found libc6-udeb (>= 2.22) in /var/lib/dpkg/info/libc6:i386.shlibs
> | No associated package found for debian/libtinfo5-udeb/lib/libtinfo.so.5
> | Using shlibs+objdump for libtinfo.so.5 (file 
> debian/libtinfo5-udeb/lib/libtinfo.so.5)
> |  Looking up shlibs dependency of libtinfo.so.5 provided by ''
> |  Found lib64tinfo5 (>= 6) in debian/lib64tinfo5/DEBIAN/shlibs
> `----
> 
> In contrast, a cross-build for armhf where no multilib packages are
> built picks up the right shlibs file for libtinfo.so.5:
> 
> ,----
> | >> Scanning debian/libtinfo5-udeb/lib/libtic.so.5.9 (for Depends field)
> | Library libc.so.6 found in /lib/arm-linux-gnueabihf/libc.so.6
> | Library libtinfo.so.5 found in debian/libtinfo5-udeb/lib/libtinfo.so.5
> | Library ld-linux-armhf.so.3 found in 
> /lib/arm-linux-gnueabihf/ld-linux-armhf.so.3
> | No associated package found for debian/libtinfo5-udeb/lib/libtinfo.so.5
> | Using shlibs+objdump for libtinfo.so.5 (file 
> debian/libtinfo5-udeb/lib/libtinfo.so.5)
> |  Looking up shlibs dependency of libtinfo.so.5 provided by ''
> |  Found libtinfo5-udeb (>= 6) in debian/libtinfo5/DEBIAN/shlibs
> `----
> 
> A patch for ncurses that should be suitable for reproducing the problem
> can be found at
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=819397#46.

Right, Helmut Grohne also reported recently on IRC a similar issue when
cross-building some sources that generate multilib packages.

In Helmut's case his only sane solution is to get dpkg-shlibdeps to grow
an option so that some of the build-trees can be ignored (he is currently
adding the system multiarch dir using a relative path via -l, to make
that have preference!). Which I've just implemented (attached). You could
also use that (once that's in a released dpkg), with the following
dh_shlibdeps calls in debian/rules (which I tested it to work):

  ,---
  dh_shlibdeps -p$(package-ti)-udeb -- \
    -Idebian/$(package-ti-32) -Idebian/$(package-ti-64)
  dh_shlibdeps -s -N$(package-ti)-udeb
  `---

But in your case I think simply using -x with the name of the two
multilib paclages should be enough, as the undesirable dependency is
simply a self-depends masked as a multilib one. And this can be done
right now.

Your other option could be to try to remove the multilib packages,
which are in general an abomination :) and conceptually subvert the
underlying packaging system. AFAICS only libreadline-dev and
grub-legacy use them. And the latter seems to me might be a packaging
error, as the bootloader should have no dynamic dependency, and I'd
say the host tools should be built for the host system.

(PS: I had to take a shower after installing the multilib packages to
test the reproducer. ;)

Thanks,
Guillem
diff --git i/man/dpkg-shlibdeps.1 w/man/dpkg-shlibdeps.1
index fb59dad..0c617dd 100644
--- i/man/dpkg-shlibdeps.1
+++ w/man/dpkg-shlibdeps.1
@@ -232,6 +232,11 @@ and you want to ensure that you get the dependency from a given binary
 package. You can use this option multiple times: directories will be
 tried in the same order before directories of other binary packages.
 .TP
+.BI \-I package-build-dir
+Ignore \fIpackage-build-dir\fP when looking for shlibs, symbols, and shared
+libraries files (since dpkg 1.18.5).
+You can use this option multiple times.
+.TP
 .BI \-\-ignore\-missing\-info
 Do not fail if dependency information can't be found for a shared library
 (since dpkg 1.14.8).
diff --git i/scripts/dpkg-shlibdeps.pl w/scripts/dpkg-shlibdeps.pl
index 8c83025..ff64b95 100755
--- i/scripts/dpkg-shlibdeps.pl
+++ w/scripts/dpkg-shlibdeps.pl
@@ -71,15 +71,10 @@ my $warnings = WARN_SYM_NOT_FOUND | WARN_DEP_AVOIDABLE;
 my $debug = 0;
 my @exclude = ();
 my @pkg_dir_to_search = ();
+my @pkg_dir_to_ignore = ();
 my $host_arch = get_host_arch();
 
 my (@pkg_shlibs, @pkg_symbols, @pkg_root_dirs);
-if (-d 'debian') {
-    push @pkg_symbols, glob 'debian/*/DEBIAN/symbols';
-    push @pkg_shlibs, glob 'debian/*/DEBIAN/shlibs';
-    my %uniq = map { guess_pkg_root_dir($_) => 1 } (@pkg_symbols, @pkg_shlibs);
-    push @pkg_root_dirs, keys %uniq;
-}
 
 my ($stdout, %exec);
 foreach (@ARGV) {
@@ -93,6 +88,8 @@ foreach (@ARGV) {
 	Dpkg::Shlibs::add_library_dir($1);
     } elsif (m/^-S(.*)$/) {
 	push @pkg_dir_to_search, $1;
+    } elsif (m/^-I(.*)$/) {
+	push @pkg_dir_to_ignore, $1;
     } elsif (m/^-O$/) {
 	$stdout = 1;
     } elsif (m/^-O(.+)$/) {
@@ -146,6 +143,18 @@ foreach (@ARGV) {
 }
 usageerr(g_('need at least one executable')) unless scalar keys %exec;
 
+sub ignore_path {
+    my $path = shift;
+    return any { $path =~ /^\Q$_\E/ } @pkg_dir_to_ignore;
+}
+
+if (-d 'debian') {
+    push @pkg_symbols, grep { !ignore_path($_) } glob 'debian/*/DEBIAN/symbols';
+    push @pkg_shlibs, grep { !ignore_path($_) } glob 'debian/*/DEBIAN/shlibs';
+    my %uniq = map { guess_pkg_root_dir($_) => 1 } (@pkg_symbols, @pkg_shlibs);
+    push @pkg_root_dirs, keys %uniq;
+}
+
 my $control = Dpkg::Control::Info->new();
 my $fields = $control->get_source();
 my $bd_value = deps_concat($fields->{'Build-Depends'}, $fields->{'Build-Depends-Arch'});
@@ -563,7 +572,9 @@ sub usage {
   -t<type>                 set package type (default is deb).
   -x<package>              exclude package from the generated dependencies.
   -S<package-build-dir>    search needed libraries in the given
-                           package build directory first.
+                             package build directory first.
+  -I<package-build-dir>    ignore needed libraries, shlibs and symbols files
+                             in the given build directory.
   -v                       enable verbose mode (can be used multiple times).
   --ignore-missing-info    don't fail if dependency information can't be found.
   --warnings=<value>       define set of active warnings (see manual page).
@@ -807,6 +818,7 @@ sub my_find_library {
     # - package build tree given on the command line (option -S)
     # - other package build trees that contain either a shlibs or a
     # symbols file
+    # - but ignore build tree given onthe command line (option -I)
     my @builddirs;
     my $pkg_root = guess_pkg_root_dir($execfile);
     push @builddirs, $pkg_root if defined $pkg_root;
@@ -814,6 +826,7 @@ sub my_find_library {
     push @builddirs, @pkg_root_dirs;
     my %dir_checked;
     foreach my $builddir (@builddirs) {
+	next if ignore_path($builddir);
 	next if defined($dir_checked{$builddir});
 	$file = find_library($lib, \@RPATH, $format, $builddir);
 	return $file if defined($file);

Reply via email to