Blob Blame History Raw
# Patch sent to upstream developer on 2009-02-01

icecc-create-env: handle relative paths in ld.so.conf includes

From: Michal Schmidt <mschmidt@redhat.com>

In Fedora ld.so.conf contains an include directive with a relative path.
ldconfig does not accept relative include paths when using -r.
Instead of copying ld.so.conf verbatim, make a modified copy of it where
relative paths are replaced with absolute to make ldconfig happy.

Another improvement would be to add the included config files to the
environment too, but I do not have a need for it in practice and haven't
implemented it yet.
---

 client/icecc-create-env |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)


diff --git a/client/icecc-create-env b/client/icecc-create-env
index 860b10c..a605c0e 100755
--- a/client/icecc-create-env
+++ b/client/icecc-create-env
@@ -117,7 +117,17 @@ specfile=`$added_gcc -print-file-name=specs`
 if test -n "$specfile" && test "$specfile" != "specs" && test -e "$specfile"; then
   add_file "$specfile"
 fi
-add_file /etc/ld.so.conf
+
+# for ldconfig -r to work, ld.so.conf must not contain relative paths
+# in include directives. Make them absolute.
+tmp_ld_so_conf=`mktemp /tmp/icecc_ld_so_confXXXXXX`
+while read directive path; do
+  if [ "$directive" = "include" -a "${path:0:1}" != "/" ]; then
+    path="/etc/$path"
+  fi
+  echo "$directive $path"
+done </etc/ld.so.conf >$tmp_ld_so_conf
+add_file $tmp_ld_so_conf /etc/ld.so.conf
 
 tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
 # special case for weird multilib setups
@@ -175,3 +185,4 @@ tar -czhf "$mydir/$md5".tar.gz $target_files || {
 }
 cd ..
 rm -rf $tempdir
+rm -f $tmp_ld_so_conf