This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: ldconfig problems


>>>>> Ulrich Drepper writes:

Uli> Andreas Jaeger <aj@suse.de> writes:
>> Here's an updated patch.  Is this one ok?

Uli> It works to the extend you planned it to.

Uli> How I understood Roland (and how I would do this) is a bit different.
Uli> I would have the prefix (either compiled in or passed on the ldconfig
Uli> command line) determine which directories to search in a way similar
Uli> to chroot().  I.e., no directory below the prefix directory or in a
ldconfig has already a chroot option - but does a complete chroot here.
  -r ROOT                    Change to and use ROOT as root directory

Uli> different tree is ever used.  Example:

Uli> - I'm installing in /test.  This means the sysconfig dir is /test/etc,
Uli>   the libraries are in /test/lib etc

Uli> - ldconfig  would search for DSOs in /test/lib and perhaps /test/usr/lib
Uli>   (unless overwritten by a ld.so.conf file)

Uli> - ldconfig will never look into /lib, /usr/lib etc unless told so
You're right, my patch doesn't handle the libraries correctly.  I'll
change this - but that should be all.  Have a look at the appended patch.

Uli> This has the advantage that you can have a completely isolated testing
Uli> arena without fearing to pickup old DSOs.  If this is wanted, ldconfig
Uli> can be told to look into the regular directories.

I do have a problem with the location of the configuration
(ld.so.conf) and the cache file (ld.so.cache).  If the user specifies
configure with --sysconfdir=/etc --prefix=/test, we can't use prefix
for the sysconfig dir.  Therefore I think my solution is ok.

I've just tested the patch in a build with
--prefix=/usr/src/test/glibc-2.2 and only files in that directory have
been used.

Is this version ok now?

Andreas

2000-07-12  Andreas Jaeger  <aj@suse.de>

	* elf/Makefile (SYSCONF-FLAGS): Added to pass sysconfdir to
	compiler.
	(CFLAGS-cache.c): Added, uses SYSCONF-FLAGS.
	(CFLAGS-dl-cache.c): Likewise.
	(CFLAGS-ldconfig.c): Added, passes directory locations.

	* sysdeps/generic/dl-cache.h (LD_SO_CACHE): Use SYSCONFDIR to
	locate cache.
	* elf/ldconfig.c (LD_SO_CONF): Likewise.
	(main): Use configured LIBDIR and SLIBDIR.

============================================================
Index: elf/Makefile
--- elf/Makefile	2000/07/01 15:36:11	1.156
+++ elf/Makefile	2000/07/12 07:15:15
@@ -215,6 +215,10 @@
 $(objpfx)sprof: $(libdl)
 
 $(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
+SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
+CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' -D'SLIBDIR="$(slibdir)"'
+CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
+CFLAGS-cache.c = $(SYSCONF-FLAGS)
 
 test-modules = $(addprefix $(objpfx),$(addsuffix .so,$(strip $(modules-names))))
 generated += $(addsuffix .so,$(strip $(modules-names)))
============================================================
Index: elf/ldconfig.c
--- elf/ldconfig.c	2000/05/10 09:14:27	1.4
+++ elf/ldconfig.c	2000/07/12 07:15:16
@@ -41,7 +41,7 @@
 #include "dl-procinfo.h"
 
 #ifndef LD_SO_CONF
-# define LD_SO_CONF "/etc/ld.so.conf"
+# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
 #endif
 
 /* Get libc version number.  */
@@ -152,7 +152,7 @@
 is_hwcap (const char *name)
 {
   int hwcap_idx = _dl_string_hwcap (name);
-  
+
   if (hwcap_idx != -1 && ((1 << hwcap_idx) & HWCAP_IMPORTANT))
     return 1;
   return 0;
@@ -802,8 +802,9 @@
   if (!opt_only_cline)
     {
       /* Always add the standard search paths.  */
-      add_dir ("/lib");
-      add_dir ("/usr/lib");
+      add_dir (SLIBDIR);
+      if (strcmp (SLIBDIR, LIBDIR))
+	add_dir (LIBDIR);
 
       parse_conf (config_file);
     }
============================================================
Index: sysdeps/generic/dl-cache.h
--- sysdeps/generic/dl-cache.h	2000/05/17 11:04:01	1.3
+++ sysdeps/generic/dl-cache.h	2000/07/12 07:15:16
@@ -27,7 +27,7 @@
 #endif
 
 #ifndef LD_SO_CACHE
-# define LD_SO_CACHE "/etc/ld.so.cache"
+# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
 #endif
 
 #define CACHEMAGIC "ld.so-1.7.0"

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]