Просмотр исходного кода

dpkg-shlibdeps: support RUNPATH exactly like RPATH

* scripts/Dpkg/Shlibs/Objdump.pm (_parse): Support RUNPATH exactly
like RPATH but taking precedence over it.

In reality RUNPATH is like RPATH but it's used after having looked in
directories listed in LD_LIBRARY_PATH while RPATH is used before (but only
if RUNPATH is not set). See dlopen and ld.so manual page. We ignore that
difference in the case of dpkg-shlibdeps as LD_LIBRARY_PATH is usually not
used except for cases where RPATH is not used when it really should have
been.
Raphael Hertzog лет назад: 17
Родитель
Сommit
e56cc94ba9
3 измененных файлов с 15 добавлено и 1 удалено
  1. 5 0
      ChangeLog
  2. 2 0
      debian/changelog
  3. 8 1
      scripts/Dpkg/Shlibs/Objdump.pm

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+2008-11-08  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/Dpkg/Shlibs/Objdump.pm (_parse): Support RUNPATH exactly
+	like RPATH but taking precedence over it.
+
 2008-10-22  Guillem Jover  <guillem@debian.org>
 
 	* lib/ehandle.c (error_unwind): Remove unused cleanupentry code.

+ 2 - 0
debian/changelog

@@ -79,6 +79,8 @@ dpkg (1.15.0) UNRELEASED; urgency=low
     Closes: #395140
   * Largely improve and update dpkg-buildpackage's manual page.
   * Clarify two points in dpkg-source(1). Closes: #490693
+  * Support RUNPATH exactly like RPATH in dpkg-shlibdeps. Closes: #502258
+    Thanks to Javier Serrano Polo <jasp00@terra.es>.
 
   [ Pierre Habouzit ]
   * Add a --query option to update-alternatives. Closes: #336091, #441904

+ 8 - 1
scripts/Dpkg/Shlibs/Objdump.pm

@@ -197,8 +197,15 @@ sub _parse {
 		$self->{HASH} = $1;
 	    } elsif (/^\s*GNU_HASH\s+(\S+)/) {
 		$self->{GNU_HASH} = $1;
+	    } elsif (/^\s*RUNPATH\s+(\S+)/) {
+                # RUNPATH takes precedence over RPATH but is
+                # considered after LD_LIBRARY_PATH while RPATH
+                # is considered before (if RUNPATH is not set).
+                $self->{RPATH} = [ split (/:/, $1) ];
 	    } elsif (/^\s*RPATH\s+(\S+)/) {
-		push @{$self->{RPATH}}, split (/:/, $1);
+                unless (scalar(@{$self->{RPATH}})) {
+                    $self->{RPATH} = [ split (/:/, $1) ];
+                }
 	    }
 	} elsif ($section eq "none") {
 	    if (/^\s*\S+:\s*file\s+format\s+(\S+)\s*$/) {