Re: ldconfig annoyance
Johannes Zellner <johannes@zellner.org> writes:
> Hi,
>
> ldconfig 2.2.2, as it ships with 'debian unstable' unfortunately
> always puts /lib and /usr/lib BEFORE all other paths as specified
> in /etc/ld.so.conf. This wasn't the case before. I just checked
> an older ldconfig (from the ldso-1.9.11 source) where /lib and
> /usr/lib come AFTER the libs specified in /etc/ld.so.conf.
ldconfig in glibc is a clean implementation and has nothing at the
source level to do with the older ldconfig. This is just one of the
points where ldconfig was not properly documented.
> To give you an idea of my problem:
> My graphics chip needs a patched version of libsvga, which I
> put to /usr/local/lib. As many programs which use libsvga will
> be setuid root, LD_LIBRARY_PATH won't be recognized by the dynamic
> loader. So I need to have a means to tell the dynamic loader to use
> /usr/local/lib BEFORE /usr/lib!
>
> The ideal behaviour would be IMHO:
>
> 1) if /lib and /usr/lib are NOT specified in /etc/ld.so.conf:
> put these BEFORE the libs in ld.so.conf, i.e.:
>
> /lib
> /usr/lib
> ... as specified in /etc/ld.so.conf
>
> 2) if /lib and /usr/lib ARE specified in /etc/ld.so.conf:
> don't change anything in the order of ld.so.conf, i.e.,
> if they come at the end in ld.so.conf, search them after
> all other libs:
>
> /usr/local/lib
> /lib
> /usr/lib
That is IMO to complicated. The following can be easily done:
1) if /lib and /usr/lib are NOT specified in /etc/ld.so.conf:
put these *AFTER* the libs in ld.so.conf, i.e.:
... as specified in /etc/ld.so.conf
/lib
/usr/lib
2)
if /lib and /usr/lib ARE specified in /etc/ld.so.conf:
don't change anything in the order of ld.so.conf, i.e.,
if they come at the end in ld.so.conf, search them after
all other libs:
/usr/local/lib
/lib
/usr/lib
To implement this, you just need to move in ldconfig.c the parse_conf
call before the two add_dir calls (add_dir removes duplicates!):
if (!opt_only_cline)
{
/* Always add the standard search paths. */
add_dir (SLIBDIR);
if (strcmp (SLIBDIR, LIBDIR))
add_dir (LIBDIR);
parse_conf (config_file);
}
Andreas
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj
Reply to: