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

Dpkg::Shlibs: Reorder library directories

The correct order is:

  «dpkg-shlibdeps -l» > ENV{LD_LIBRARY_PATHS} > cross-multiarch >
  DEFAULT_LIBRARY_PATH > ld.so.conf > DEFAULT_MULTILIB_PATH

This preserves the ld.so behavior, gives preference to the cross paths,
and preserves -l and ENV{LD_LIBRARY_PATHS} as the ones to override all
the rest.
Guillem Jover лет назад: 11
Родитель
Сommit
8f28c5172c
2 измененных файлов с 17 добавлено и 12 удалено
  1. 3 0
      debian/changelog
  2. 14 12
      scripts/Dpkg/Shlibs.pm

+ 3 - 0
debian/changelog

@@ -76,6 +76,9 @@ dpkg (1.18.0) UNRELEASED; urgency=low
   * Cleanup default dpkg-shlibdeps shared library directory search list:
     - Do not add cross-root directories (/<triplet>/ and /usr/<triplet>/).
     - Remove ancient multilib /emul/ia32-linux/ paths.
+    - Reorder directory precedence to:
+      «dpkg-shlibdeps -l» > ENV{LD_LIBRARY_PATHS} > cross-multiarch >
+      DEFAULT_LIBRARY_PATH > ld.so.conf > DEFAULT_MULTILIB_PATH
 
   * Perl modules:
     - Rename and deprecate Dpkg::Gettext _g function with new g_.

+ 14 - 12
scripts/Dpkg/Shlibs.pm

@@ -81,12 +81,15 @@ sub blank_library_paths {
 }
 
 sub setup_library_paths {
-    @librarypaths = DEFAULT_LIBRARY_PATH;
-
-    # Update library paths with ld.so config.
-    parse_ldso_conf('/etc/ld.so.conf') if -e '/etc/ld.so.conf';
+    @librarypaths = ();
 
-    push @librarypaths, DEFAULT_MULTILIB_PATH;
+    # XXX: Deprecated. Update library paths with LD_LIBRARY_PATH.
+    if ($ENV{LD_LIBRARY_PATH}) {
+        foreach my $path (split /:/, $ENV{LD_LIBRARY_PATH}) {
+            $path =~ s{/+$}{};
+            push @librarypaths, $path;
+        }
+    }
 
     # Adjust set of directories to consider when we're in a situation of a
     # cross-build or a build of a cross-compiler.
@@ -107,13 +110,12 @@ sub setup_library_paths {
         push @librarypaths, "/lib/$multiarch", "/usr/lib/$multiarch";
     }
 
-    # XXX: Deprecated. Update library paths with LD_LIBRARY_PATH.
-    if ($ENV{LD_LIBRARY_PATH}) {
-        foreach my $path (reverse split( /:/, $ENV{LD_LIBRARY_PATH})) {
-            $path =~ s{/+$}{};
-            add_library_dir($path);
-        }
-    }
+    push @librarypaths, DEFAULT_LIBRARY_PATH;
+
+    # Update library paths with ld.so config.
+    parse_ldso_conf('/etc/ld.so.conf') if -e '/etc/ld.so.conf';
+
+    push @librarypaths, DEFAULT_MULTILIB_PATH;
 
     $librarypaths_init = 1;
 }