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

multiarch support: ldconfig needs to look at system paths

Hi all,

After converting Ubuntu natty to use multiarch paths, I've gotten reports
that only the multiarch directories are included in ldconfig's cache.  The
reason for this is that ldconfig has a different view of the system paths
than ld.so itself does.

The attached patch remedies this by bringing ldconfig's view into line with
that of ld.so.

Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org
Description: make ldconfig use the built-in system paths
 Make ldconfig use the same view of built-in system paths that ld.so does,
 instead of just using SLIBDIR and LIBDIR; this corrects a failure of
 ldconfig to cache libraries in non-multiarch directories when building for
 multiarch, even though they're on the system path.
Author: Steve Langasek <steve.langasek@linaro.org>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/736932

Index: trunk/elf/ldconfig.c
--- trunk.orig/elf/ldconfig.c
+++ trunk/elf/ldconfig.c
@@ -59,6 +59,17 @@
 #define PACKAGE _libc_intl_domainname
+/* Get the generated information about the trusted/standard directories.  */
+#include "trusted-dirs.h"
+static const char system_dirs[] = SYSTEM_DIRS;
+static const size_t system_dirs_len[] =
+#define nsystem_dirs_len \
+  (sizeof (system_dirs_len) / sizeof (system_dirs_len[0]))
 static const struct
   const char *name;
@@ -1353,12 +1364,19 @@
   if (!opt_only_cline)
+      const char *strp = system_dirs;
+      size_t idx = 0;
       parse_conf (config_file, true);
       /* Always add the standard search paths.  */
-      add_system_dir (SLIBDIR);
-      if (strcmp (SLIBDIR, LIBDIR))
-	add_system_dir (LIBDIR);
+      do
+        {
+          add_system_dir (strp);
+          strp += system_dirs_len[idx] + 1;
+          idx++;
+        }
+      while (idx < nsystem_dirs_len);
   const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE;

Attachment: signature.asc
Description: Digital signature

Reply to: