libtool-patches
[Top][All Lists]
Advanced

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

libtool-1.5.10.ldsoinclude.patch


From: Daniel Reed
Subject: libtool-1.5.10.ldsoinclude.patch
Date: Wed, 17 Nov 2004 01:56:53 -0500 (EST)

In Libtool 1.5.10's libtool.m4, on the Linux target, Libtool generates its
sys_lib_dlsearch_path_spec by combining the static entries "/lib" and "/usr/lib"
with, if it exists, the file /etc/ld.so.conf's contents.

The contents of /etc/ld.so.conf are processed using a regex:
s/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g

This should replace colons, commas, and tabs with spaces and get rid of the
=libc5 syntax that once kept ldconfig from searching the wrong directories for
files (which may no longer be needed or used).


A recent glibc introduced a new form for /etc/ld.so.conf: the "include" keyword
with an argument specifying a globable path string relative to $(dirname
/etc/ld.so.conf) of files whose contents to also parse as if they were included
in /etc/ld.so.conf.

Libtool does not handle this form, and can't be extended to support it without
changing some assumptions about the format of /etc/ld.so.conf. I am told that
/etc/ld.so.conf's format is considered an implementation detail by glibc
developers, and that no format will be guaranteed. If Libtool is to continue
parsing ld.so.conf, it will have to be with the understanding that the file
format can continue to be a moving target.

Assuming Libtool will continue parsing ld.so.conf to populate
sys_lib_dlsearch_path_spec:

The following patch causes Libtool to assume that lines in /etc/ld.so.conf that
begin with "include " are of the special form "^include relative-path$", where
relative-path is relative to /etc. The path is globbed and the contents of
matching files are brought in as if they were part of the contents of
ld.so.conf, in the location the "include " line is in ld.so.conf. This reformed
set of directories is then passed through the same transformations as before.

The patch introduces a call to awk; I found similar calls to awk elsewhere in the code so I do not believe the patches impacts portability.

After making the change and regenerating all of the files based on libtool.m4, a
diff generated against stock Libtool 1.5.10 is on the order of one hundred
thousand lines. I have included only the one line diff; the generated files will
need to be regenerated after application.


*** libtool-1.5.10_orig/libtool.m4      2004-09-19 08:15:08.000000000 -0400
--- libtool-1.5.10/libtool.m4   2004-11-17 01:17:12.340301000 -0500
***************
*** 1459,1465 ****

    # Append ld.so.conf contents to the search path
    if test -f /etc/ld.so.conf; then
!     lt_ld_extra=`$SED -e 's/[:,\t]/ /g;s/=[^=]*$//;s/=[^= ]* / /g' 
/etc/ld.so.conf | tr '\n' ' '`
      sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
    fi

--- 1459,1465 ----

    # Append ld.so.conf contents to the search path
    if test -f /etc/ld.so.conf; then
!     lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s", \[$]2)); 
skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/[:,\t]/ 
/g;s/=[^=]*$//;s/=[^= ]* / /g' | tr '\n' ' '`
      sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
    fi


--
Daniel Reed <address@hidden>      http://people.redhat.com/djr/   Giant Robots




reply via email to

[Prev in Thread] Current Thread [Next in Thread]