Hi!

On Tue, 2022-10-25 at 14:23:18 +0200, Andreas Beckmann wrote:
> Package: dpkg-dev
> Version: 1.21.9
> Severity: normal

> While checking the nvida-cuda-toolkit buildd logs [1], I came across a
> long sequence of repeated error messages:
> 
>     pkg-shlibdeps: warning: can't extract name and version from library name 
> 'libfoobar.so'
> 
> There are about 40 repetitions of this warning (with no further messages
> interleaved) for most of the libraries, but I don't know what this
> number corresponds to.
> Since nvida-cuda-toolkit just repacks upstream binary libraries we
> unfortunately have to cope with a lot of libraries without proper sonames.

> [1] https://buildd.debian.org/status/package.php?p=nvidia-cuda-toolkit

Ah, I guess something like the attached patch might do? In addition to
somewhat improving performance. :)

Thanks,
Guillem
From 12e690ec338d7ba2e808ae7f6ba7c31e060b0e8e Mon Sep 17 00:00:00 2001
From: Guillem Jover <guil...@debian.org>
Date: Tue, 25 Oct 2022 18:36:16 +0200
Subject: [PATCH] dpkg-shlibdeps: Cache soname check against shlibs files

Closes: #1022766
---
 scripts/dpkg-shlibdeps.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 6c8a2d3ab..47e79ca13 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -172,7 +172,8 @@ my %global_soname_notfound;
 my %global_soname_used;
 my %global_soname_needed;
 
-# Symfile and objdump caches
+# Shlibs, Symfile and objdump caches
+my %shlibs_cache;
 my %symfile_cache;
 my %objdump_cache;
 my %symfile_has_soname_cache;
@@ -721,6 +722,10 @@ sub split_soname {
 sub extract_from_shlibs {
     my ($soname, $shlibfile) = @_;
 
+    if (exists $shlibs_cache{$shlibfile}{$soname}) {
+        return $shlibs_cache{$shlibfile}{$soname};
+    }
+
     my $shlibs_re = qr{
         ^\s*
         (?:(\S+):\s+)?              # Optional type
@@ -738,6 +743,7 @@ sub extract_from_shlibs {
     unless (defined $libname) {
 	warning(g_("can't extract name and version from library name '%s'"),
 	        $soname);
+        $shlibs_cache{$shlibfile}{$soname} = undef;
 	return;
     }
     # Open shlibs file
@@ -769,6 +775,7 @@ sub extract_from_shlibs {
 	}
     }
     close($shlibs_fh);
+    $shlibs_cache{$shlibfile}{$soname} = $dep;
     return $dep;
 }
 
-- 
2.37.2

Reply via email to