summaryrefslogtreecommitdiff
path: root/patches/glibc/ports-2.12.1/360-tests-sandbox-libdl-paths.patch
blob: a847cdbadae49cafd74f275a68c48f18b44cde30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
when glibc runs its tests, it does so by invoking the local library loader.
in Gentoo, we build/run inside of our "sandbox" which itself is linked against
libdl (so that it can load libraries and pull out symbols).  the trouble
is that when you upgrade from an older glibc to the new one, often times
internal symbols change name or abi.  this is normally OK as you cannot use
libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
we always say "keep all of the glibc libraries from the same build".  but
when glibc runs its tests, it uses dynamic paths to point to its new local
copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
its path, and when sandbox triggers the loading of libdl, glibc does so
from the host system system.  this gets us into the case of all libraries
are from the locally compiled version of glibc except for libdl.so.

Fix by Wormo

http://bugs.gentoo.org/56898

diff -durN glibc-2.12.1.orig/grp/tst_fgetgrent.sh glibc-2.12.1/grp/tst_fgetgrent.sh
--- glibc-2.12.1.orig/grp/tst_fgetgrent.sh	2001-07-06 06:54:46.000000000 +0200
+++ glibc-2.12.1/grp/tst_fgetgrent.sh	2009-11-13 00:50:37.000000000 +0100
@@ -24,7 +24,8 @@
 rtld_installed_name=$1; shift
 
 testout=${common_objpfx}/grp/tst_fgetgrent.out
-library_path=${common_objpfx}
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
 
 result=0
 
diff -durN glibc-2.12.1.orig/iconvdata/run-iconv-test.sh glibc-2.12.1/iconvdata/run-iconv-test.sh
--- glibc-2.12.1.orig/iconvdata/run-iconv-test.sh	2008-05-15 03:59:44.000000000 +0200
+++ glibc-2.12.1/iconvdata/run-iconv-test.sh	2009-11-13 00:50:37.000000000 +0100
@@ -34,7 +34,7 @@
 export GCONV_PATH
 
 # We have to have some directories in the library path.
-LIBPATH=$codir:$codir/iconvdata
+LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
 
 # How the start the iconv(1) program.
 ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
diff -durN glibc-2.12.1.orig/iconvdata/tst-table.sh glibc-2.12.1/iconvdata/tst-table.sh
--- glibc-2.12.1.orig/iconvdata/tst-table.sh	2002-04-24 23:39:35.000000000 +0200
+++ glibc-2.12.1/iconvdata/tst-table.sh	2009-11-13 00:50:37.000000000 +0100
@@ -59,8 +59,11 @@
   irreversible=${charset}.irreversible
 fi
 
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
 # iconv in one direction.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
 ${objpfx}tst-table-from ${charset} \
   > ${objpfx}tst-${charset}.table
 
diff -durN glibc-2.12.1.orig/intl/tst-codeset.sh glibc-2.12.1/intl/tst-codeset.sh
--- glibc-2.12.1.orig/intl/tst-codeset.sh	2005-04-06 04:18:35.000000000 +0200
+++ glibc-2.12.1/intl/tst-codeset.sh	2009-11-13 00:50:37.000000000 +0100
@@ -37,6 +37,9 @@
 LOCPATH=${common_objpfx}localedata
 export LOCPATH
 
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
 ${common_objpfx}elf/ld.so --library-path $common_objpfx \
 ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
 
diff -durN glibc-2.12.1.orig/intl/tst-gettext.sh glibc-2.12.1/intl/tst-gettext.sh
--- glibc-2.12.1.orig/intl/tst-gettext.sh	2004-08-15 21:28:18.000000000 +0200
+++ glibc-2.12.1/intl/tst-gettext.sh	2009-11-13 00:50:37.000000000 +0100
@@ -51,9 +51,12 @@
 LOCPATH=${common_objpfx}localedata
 export LOCPATH
 
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
 # Now run the test.
 MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
 ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
 
 exit $?
diff -durN glibc-2.12.1.orig/intl/tst-gettext2.sh glibc-2.12.1/intl/tst-gettext2.sh
--- glibc-2.12.1.orig/intl/tst-gettext2.sh	2005-05-04 19:54:48.000000000 +0200
+++ glibc-2.12.1/intl/tst-gettext2.sh	2009-11-13 00:50:37.000000000 +0100
@@ -65,8 +65,11 @@
 LOCPATH=${objpfx}domaindir
 export LOCPATH
 
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
 # Now run the test.
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
 ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
 cmp ${objpfx}tst-gettext2.out - <<EOF
 String1 - Lang1: 1st string
diff -durN glibc-2.12.1.orig/intl/tst-translit.sh glibc-2.12.1/intl/tst-translit.sh
--- glibc-2.12.1.orig/intl/tst-translit.sh	2005-05-04 19:56:10.000000000 +0200
+++ glibc-2.12.1/intl/tst-translit.sh	2009-11-13 00:50:37.000000000 +0100
@@ -36,7 +36,10 @@
 LOCPATH=${common_objpfx}localedata
 export LOCPATH
 
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
+${common_objpfx}elf/ld.so --library-path $library_path \
 ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
 
 exit $?
diff -durN glibc-2.12.1.orig/malloc/tst-mtrace.sh glibc-2.12.1/malloc/tst-mtrace.sh
--- glibc-2.12.1.orig/malloc/tst-mtrace.sh	2005-10-15 01:40:35.000000000 +0200
+++ glibc-2.12.1/malloc/tst-mtrace.sh	2009-11-13 00:50:37.000000000 +0100
@@ -24,9 +24,12 @@
 status=0
 trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
 
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
 MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
+${common_objpfx}elf/ld.so --library-path $library_path \
   ${common_objpfx}malloc/tst-mtrace || status=1
 
 if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
diff -durN glibc-2.12.1.orig/nptl/tst-tls6.sh glibc-2.12.1/nptl/tst-tls6.sh
--- glibc-2.12.1.orig/nptl/tst-tls6.sh	2003-09-03 00:02:59.000000000 +0200
+++ glibc-2.12.1/nptl/tst-tls6.sh	2009-11-13 00:50:37.000000000 +0100
@@ -5,8 +5,8 @@
 rtld_installed_name=$1; shift
 logfile=$common_objpfx/nptl/tst-tls6.out
 
-# We have to find libc and nptl
-library_path=${common_objpfx}:${common_objpfx}nptl
+# We have to find libc and nptl (also libdl in case sandbox is in use)
+library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
 tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 	  ${common_objpfx}/nptl/tst-tls5"
 
diff -durN glibc-2.12.1.orig/posix/globtest.sh glibc-2.12.1/posix/globtest.sh
--- glibc-2.12.1.orig/posix/globtest.sh	2008-12-06 07:05:39.000000000 +0100
+++ glibc-2.12.1/posix/globtest.sh	2009-11-13 00:50:37.000000000 +0100
@@ -18,7 +18,7 @@
 esac
 
 # We have to find the libc and the NSS modules.
-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
+library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
 
 # Since we use `sort' we must make sure to use the same locale everywhere.
 LC_ALL=C
diff -durN glibc-2.12.1.orig/posix/tst-getconf.sh glibc-2.12.1/posix/tst-getconf.sh
--- glibc-2.12.1.orig/posix/tst-getconf.sh	2002-09-01 13:11:25.000000000 +0200
+++ glibc-2.12.1/posix/tst-getconf.sh	2009-11-13 00:50:37.000000000 +0100
@@ -10,7 +10,10 @@
 else
   rtld_installed_name=$1; shift
   runit() {
-    ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
+    
+  # make sure libdl is also in path in case sandbox is in use
+  library_path=${common_objpfx}:${common_objpfx}/dlfcn
+    ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
   }
 fi
 
diff -durN glibc-2.12.1.orig/posix/wordexp-tst.sh glibc-2.12.1/posix/wordexp-tst.sh
--- glibc-2.12.1.orig/posix/wordexp-tst.sh	2000-10-20 18:23:30.000000000 +0200
+++ glibc-2.12.1/posix/wordexp-tst.sh	2009-11-13 00:50:37.000000000 +0100
@@ -19,8 +19,11 @@
 "
 export IFS
 
+# make sure libdl is also in path in case sandbox is in use
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
+
 failed=0
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
 cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
 wordexp returned 0