[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#145714: dpkg-shlibdeps doesn't work correctly on the Hurd



Package: dpkg-dev
Version: 1.9.20

Hi,

the below patch fixes the issue announced in
http://lists.debian.org/debian-dpkg/2002/debian-dpkg-200204/msg00094.html

This patchs will work good enough for now.  If there will ever be two
libraries with the same name in different lib/ directories on the Hurd,
we will have to take another look at it.  However, such a situation
would be abnormal, and I don't expect it ever to occur (the only reason
it helped in GNU/Linux is that the linker had some kludges to figure it
out based on the C library linked to).

Please apply this patch, so that packages will have the right
dependencies on the Hurd.  It will make dpkg look in all */lib/
directories for the libraried accept any of the pathes, regardless
what ldd says on that issue, but only on the GNU system.

Thanks,
Marcus


--- dpkg-shlibdeps.orig	Fri May  3 20:15:33 2002
+++ dpkg-shlibdeps	Fri May  3 20:10:29 2002
@@ -20,6 +20,10 @@
 
 @depfields= qw(Suggests Recommends Depends Pre-Depends);
 
+# Determine if we are running on the GNU/Hurd system,
+# and if we do, don't let us fool by ldd's output.
+$use_ldd = (`uname -s` =~ m/^GNU/) ? 0 : 1;
+ 
 push(@INC,$dpkglibdir);
 require 'controllib.pl';
 
@@ -94,17 +98,20 @@
 for ($i=0;$i<=$#exec;$i++) {
     if (!isbin ($exec[$i])) { next; }
     
-    # First we get an ldd output to see what libs + paths we have at out
-    # disposal.
-    my %so2path = ();
-    defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
-    if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
-    while (<P>) {
-	if (m,^\s+(\S+)\s+=>\s+(\S+)\s+\(0x.+\)?$,) {
-	    $so2path{$1} = $2;
+    if ($use_ldd)
+    {
+	# First we get an ldd output to see what libs + paths we have at out
+	# disposal.
+	my %so2path = ();
+	defined($c= open(P,"-|")) || syserr("cannot fork for ldd");
+	if (!$c) { exec("ldd","--",$exec[$i]); syserr("cannot exec ldd"); }
+	while (<P>) {
+	    if (m,^\s+(\S+)\s+=>\s+(\S+)\s+\(0x.+\)?$,) {
+		$so2path{$1} = $2;
+	    }
 	}
+	close(P); $? && subprocerr("ldd on \`$exec[$i]'");
     }
-    close(P); $? && subprocerr("ldd on \`$exec[$i]'");
 
     # Now we get the direct deps of the program. We then check back with
     # the ldd output from above to see what our path is.
@@ -117,14 +124,22 @@
 		push(@libname,$2);
 		push(@libsoname,$3);
 		push(@libf,$execf[$i]);
-		&warn("could not find path for $1") unless defined($so2path{$1});
-		push(@libfiles,$so2path{$1});
+		if ($use_ldd) {
+		    &warn("could not find path for $1") unless defined($so2path{$1});
+		    push(@libfiles,$so2path{$1});
+		} else {
+		    push(@libfiles,"*/lib/$1");
+		}
 	    } elsif (m,^\s*NEEDED\s+((\S+)-(\S+)\.so)$,) {
 		push(@libname,$2);
 		push(@libsoname,$3);
 		push(@libf,$execf[$i]);
-		&warn("could not find path for $1") unless defined($so2path{$1});
-		push(@libfiles,$so2path{$1});
+		if ($use_ldd) {
+		    &warn("could not find path for $1") unless defined($so2path{$1});
+		    push(@libfiles,$so2path{$1});
+		} else {
+		    push(@libfiles,"*/lib/$1");
+		}
 	    } else {
 		m,^\s*NEEDED\s+(\S+)$,;
 		&warn("format of $1 not recognized");
@@ -198,7 +213,14 @@
            &warn("diversions involved - output may be incorrect");
            print(STDERR " $_\n") || syserr("write diversion info to stderr");
        } elsif (m=^(\S+(, \S+)*): (\S+)$=) {
-           push @{$pathpackages{$+}}, split(/, /, $1);
+	   if ($use_ldd) {
+	       push @{$pathpackages{$+}}, split(/, /, $1);
+	   } else {
+	       my $pkgnames = $1;
+	       my $libpath = $+;
+	       $libpath =~ s=^.*(/lib/[^/]+)$=*$1=;
+	       push @{$pathpackages{$libpath}}, split(/, /, $pkgnames);
+	   }
        } else {
            &warn("unknown output from dpkg --search: \`$_'");
        }


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: