Blob Blame History Raw
From 126bacee1c6f9b85ffca02fd3473fd1165f1c5c2 Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Wed, 28 Jan 2009 23:39:51 +0100
Subject: [PATCH] icecc-create-env: handle relative paths in ld.so.conf includes

In Fedora ld.so.conf contains an include directive with a relative path.
ldconfig does not accept relative include paths when using -r.
Rewrite includes in ld.so.conf to absolute paths.
---
 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
-- 
1.6.0.6