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