1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/patches/glibc/ports-2.12.1/360-tests-sandbox-libdl-paths.patch Mon Sep 12 14:09:31 2011 +0200
1.3 @@ -0,0 +1,193 @@
1.4 +when glibc runs its tests, it does so by invoking the local library loader.
1.5 +in Gentoo, we build/run inside of our "sandbox" which itself is linked against
1.6 +libdl (so that it can load libraries and pull out symbols). the trouble
1.7 +is that when you upgrade from an older glibc to the new one, often times
1.8 +internal symbols change name or abi. this is normally OK as you cannot use
1.9 +libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
1.10 +we always say "keep all of the glibc libraries from the same build". but
1.11 +when glibc runs its tests, it uses dynamic paths to point to its new local
1.12 +copies of libraries. if the test doesnt use libdl, then glibc doesnt add
1.13 +its path, and when sandbox triggers the loading of libdl, glibc does so
1.14 +from the host system system. this gets us into the case of all libraries
1.15 +are from the locally compiled version of glibc except for libdl.so.
1.16 +
1.17 +Fix by Wormo
1.18 +
1.19 +http://bugs.gentoo.org/56898
1.20 +
1.21 +diff -durN glibc-2.12.1.orig/grp/tst_fgetgrent.sh glibc-2.12.1/grp/tst_fgetgrent.sh
1.22 +--- glibc-2.12.1.orig/grp/tst_fgetgrent.sh 2001-07-06 06:54:46.000000000 +0200
1.23 ++++ glibc-2.12.1/grp/tst_fgetgrent.sh 2009-11-13 00:50:37.000000000 +0100
1.24 +@@ -24,7 +24,8 @@
1.25 + rtld_installed_name=$1; shift
1.26 +
1.27 + testout=${common_objpfx}/grp/tst_fgetgrent.out
1.28 +-library_path=${common_objpfx}
1.29 ++# make sure libdl is also in path in case sandbox is in use
1.30 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.31 +
1.32 + result=0
1.33 +
1.34 +diff -durN glibc-2.12.1.orig/iconvdata/run-iconv-test.sh glibc-2.12.1/iconvdata/run-iconv-test.sh
1.35 +--- glibc-2.12.1.orig/iconvdata/run-iconv-test.sh 2008-05-15 03:59:44.000000000 +0200
1.36 ++++ glibc-2.12.1/iconvdata/run-iconv-test.sh 2009-11-13 00:50:37.000000000 +0100
1.37 +@@ -34,7 +34,7 @@
1.38 + export GCONV_PATH
1.39 +
1.40 + # We have to have some directories in the library path.
1.41 +-LIBPATH=$codir:$codir/iconvdata
1.42 ++LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
1.43 +
1.44 + # How the start the iconv(1) program.
1.45 + ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
1.46 +diff -durN glibc-2.12.1.orig/iconvdata/tst-table.sh glibc-2.12.1/iconvdata/tst-table.sh
1.47 +--- glibc-2.12.1.orig/iconvdata/tst-table.sh 2002-04-24 23:39:35.000000000 +0200
1.48 ++++ glibc-2.12.1/iconvdata/tst-table.sh 2009-11-13 00:50:37.000000000 +0100
1.49 +@@ -59,8 +59,11 @@
1.50 + irreversible=${charset}.irreversible
1.51 + fi
1.52 +
1.53 ++# make sure libdl is also in path in case sandbox is in use
1.54 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.55 ++
1.56 + # iconv in one direction.
1.57 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
1.58 ++${common_objpfx}elf/ld.so --library-path $library_path \
1.59 + ${objpfx}tst-table-from ${charset} \
1.60 + > ${objpfx}tst-${charset}.table
1.61 +
1.62 +diff -durN glibc-2.12.1.orig/intl/tst-codeset.sh glibc-2.12.1/intl/tst-codeset.sh
1.63 +--- glibc-2.12.1.orig/intl/tst-codeset.sh 2005-04-06 04:18:35.000000000 +0200
1.64 ++++ glibc-2.12.1/intl/tst-codeset.sh 2009-11-13 00:50:37.000000000 +0100
1.65 +@@ -37,6 +37,9 @@
1.66 + LOCPATH=${common_objpfx}localedata
1.67 + export LOCPATH
1.68 +
1.69 ++# make sure libdl is also in path in case sandbox is in use
1.70 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.71 ++
1.72 + ${common_objpfx}elf/ld.so --library-path $common_objpfx \
1.73 + ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
1.74 +
1.75 +diff -durN glibc-2.12.1.orig/intl/tst-gettext.sh glibc-2.12.1/intl/tst-gettext.sh
1.76 +--- glibc-2.12.1.orig/intl/tst-gettext.sh 2004-08-15 21:28:18.000000000 +0200
1.77 ++++ glibc-2.12.1/intl/tst-gettext.sh 2009-11-13 00:50:37.000000000 +0100
1.78 +@@ -51,9 +51,12 @@
1.79 + LOCPATH=${common_objpfx}localedata
1.80 + export LOCPATH
1.81 +
1.82 ++# make sure libdl is also in path in case sandbox is in use
1.83 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.84 ++
1.85 + # Now run the test.
1.86 + MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
1.87 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
1.88 ++${common_objpfx}elf/ld.so --library-path $library_path \
1.89 + ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
1.90 +
1.91 + exit $?
1.92 +diff -durN glibc-2.12.1.orig/intl/tst-gettext2.sh glibc-2.12.1/intl/tst-gettext2.sh
1.93 +--- glibc-2.12.1.orig/intl/tst-gettext2.sh 2005-05-04 19:54:48.000000000 +0200
1.94 ++++ glibc-2.12.1/intl/tst-gettext2.sh 2009-11-13 00:50:37.000000000 +0100
1.95 +@@ -65,8 +65,11 @@
1.96 + LOCPATH=${objpfx}domaindir
1.97 + export LOCPATH
1.98 +
1.99 ++# make sure libdl is also in path in case sandbox is in use
1.100 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.101 ++
1.102 + # Now run the test.
1.103 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
1.104 ++${common_objpfx}elf/ld.so --library-path $library_path \
1.105 + ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
1.106 + cmp ${objpfx}tst-gettext2.out - <<EOF
1.107 + String1 - Lang1: 1st string
1.108 +diff -durN glibc-2.12.1.orig/intl/tst-translit.sh glibc-2.12.1/intl/tst-translit.sh
1.109 +--- glibc-2.12.1.orig/intl/tst-translit.sh 2005-05-04 19:56:10.000000000 +0200
1.110 ++++ glibc-2.12.1/intl/tst-translit.sh 2009-11-13 00:50:37.000000000 +0100
1.111 +@@ -36,7 +36,10 @@
1.112 + LOCPATH=${common_objpfx}localedata
1.113 + export LOCPATH
1.114 +
1.115 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
1.116 ++# make sure libdl is also in path in case sandbox is in use
1.117 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.118 ++
1.119 ++${common_objpfx}elf/ld.so --library-path $library_path \
1.120 + ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
1.121 +
1.122 + exit $?
1.123 +diff -durN glibc-2.12.1.orig/malloc/tst-mtrace.sh glibc-2.12.1/malloc/tst-mtrace.sh
1.124 +--- glibc-2.12.1.orig/malloc/tst-mtrace.sh 2005-10-15 01:40:35.000000000 +0200
1.125 ++++ glibc-2.12.1/malloc/tst-mtrace.sh 2009-11-13 00:50:37.000000000 +0100
1.126 +@@ -24,9 +24,12 @@
1.127 + status=0
1.128 + trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
1.129 +
1.130 ++# make sure libdl is also in path in case sandbox is in use
1.131 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.132 ++
1.133 + MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
1.134 + LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
1.135 +-${common_objpfx}elf/ld.so --library-path $common_objpfx \
1.136 ++${common_objpfx}elf/ld.so --library-path $library_path \
1.137 + ${common_objpfx}malloc/tst-mtrace || status=1
1.138 +
1.139 + if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
1.140 +diff -durN glibc-2.12.1.orig/nptl/tst-tls6.sh glibc-2.12.1/nptl/tst-tls6.sh
1.141 +--- glibc-2.12.1.orig/nptl/tst-tls6.sh 2003-09-03 00:02:59.000000000 +0200
1.142 ++++ glibc-2.12.1/nptl/tst-tls6.sh 2009-11-13 00:50:37.000000000 +0100
1.143 +@@ -5,8 +5,8 @@
1.144 + rtld_installed_name=$1; shift
1.145 + logfile=$common_objpfx/nptl/tst-tls6.out
1.146 +
1.147 +-# We have to find libc and nptl
1.148 +-library_path=${common_objpfx}:${common_objpfx}nptl
1.149 ++# We have to find libc and nptl (also libdl in case sandbox is in use)
1.150 ++library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
1.151 + tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
1.152 + ${common_objpfx}/nptl/tst-tls5"
1.153 +
1.154 +diff -durN glibc-2.12.1.orig/posix/globtest.sh glibc-2.12.1/posix/globtest.sh
1.155 +--- glibc-2.12.1.orig/posix/globtest.sh 2008-12-06 07:05:39.000000000 +0100
1.156 ++++ glibc-2.12.1/posix/globtest.sh 2009-11-13 00:50:37.000000000 +0100
1.157 +@@ -18,7 +18,7 @@
1.158 + esac
1.159 +
1.160 + # We have to find the libc and the NSS modules.
1.161 +-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
1.162 ++library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
1.163 +
1.164 + # Since we use `sort' we must make sure to use the same locale everywhere.
1.165 + LC_ALL=C
1.166 +diff -durN glibc-2.12.1.orig/posix/tst-getconf.sh glibc-2.12.1/posix/tst-getconf.sh
1.167 +--- glibc-2.12.1.orig/posix/tst-getconf.sh 2002-09-01 13:11:25.000000000 +0200
1.168 ++++ glibc-2.12.1/posix/tst-getconf.sh 2009-11-13 00:50:37.000000000 +0100
1.169 +@@ -10,7 +10,10 @@
1.170 + else
1.171 + rtld_installed_name=$1; shift
1.172 + runit() {
1.173 +- ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
1.174 ++
1.175 ++ # make sure libdl is also in path in case sandbox is in use
1.176 ++ library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.177 ++ ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
1.178 + }
1.179 + fi
1.180 +
1.181 +diff -durN glibc-2.12.1.orig/posix/wordexp-tst.sh glibc-2.12.1/posix/wordexp-tst.sh
1.182 +--- glibc-2.12.1.orig/posix/wordexp-tst.sh 2000-10-20 18:23:30.000000000 +0200
1.183 ++++ glibc-2.12.1/posix/wordexp-tst.sh 2009-11-13 00:50:37.000000000 +0100
1.184 +@@ -19,8 +19,11 @@
1.185 + "
1.186 + export IFS
1.187 +
1.188 ++# make sure libdl is also in path in case sandbox is in use
1.189 ++library_path=${common_objpfx}:${common_objpfx}/dlfcn
1.190 ++
1.191 + failed=0
1.192 +-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
1.193 ++${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
1.194 + ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
1.195 + cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
1.196 + wordexp returned 0