patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue May 03 00:19:56 2011 +0200 (2011-05-03)
changeset 2438 2ba5655f6297
permissions -rw-r--r--
libc/glibc: add 2.13

Patchset provided by "Ioannis E. Venetis" <venetis@mail.capsl.udel.edu>
http://sourceware.org/ml/crossgcc/2011-04/msg00072.html
http://sourceware.org/ml/crossgcc/2011-04/msg00073.html

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
yann@2438
     1
when glibc runs its tests, it does so by invoking the local library loader.
yann@2438
     2
in Gentoo, we build/run inside of our "sandbox" which itself is linked against
yann@2438
     3
libdl (so that it can load libraries and pull out symbols).  the trouble
yann@2438
     4
is that when you upgrade from an older glibc to the new one, often times
yann@2438
     5
internal symbols change name or abi.  this is normally OK as you cannot use
yann@2438
     6
libc.so from say version 2.3.6 but libpthread.so from say version 2.5, so
yann@2438
     7
we always say "keep all of the glibc libraries from the same build".  but
yann@2438
     8
when glibc runs its tests, it uses dynamic paths to point to its new local
yann@2438
     9
copies of libraries.  if the test doesnt use libdl, then glibc doesnt add
yann@2438
    10
its path, and when sandbox triggers the loading of libdl, glibc does so
yann@2438
    11
from the host system system.  this gets us into the case of all libraries
yann@2438
    12
are from the locally compiled version of glibc except for libdl.so.
yann@2438
    13
yann@2438
    14
Fix by Wormo
yann@2438
    15
yann@2438
    16
http://bugs.gentoo.org/56898
yann@2438
    17
yann@2438
    18
diff -durN glibc-2.13.orig/grp/tst_fgetgrent.sh glibc-2.13/grp/tst_fgetgrent.sh
yann@2438
    19
--- glibc-2.13.orig/grp/tst_fgetgrent.sh	2001-07-06 06:54:46.000000000 +0200
yann@2438
    20
+++ glibc-2.13/grp/tst_fgetgrent.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
    21
@@ -24,7 +24,8 @@
yann@2438
    22
 rtld_installed_name=$1; shift
yann@2438
    23
 
yann@2438
    24
 testout=${common_objpfx}/grp/tst_fgetgrent.out
yann@2438
    25
-library_path=${common_objpfx}
yann@2438
    26
+# make sure libdl is also in path in case sandbox is in use
yann@2438
    27
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
    28
 
yann@2438
    29
 result=0
yann@2438
    30
 
yann@2438
    31
diff -durN glibc-2.13.orig/iconvdata/run-iconv-test.sh glibc-2.13/iconvdata/run-iconv-test.sh
yann@2438
    32
--- glibc-2.13.orig/iconvdata/run-iconv-test.sh	2008-05-15 03:59:44.000000000 +0200
yann@2438
    33
+++ glibc-2.13/iconvdata/run-iconv-test.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
    34
@@ -34,7 +34,7 @@
yann@2438
    35
 export GCONV_PATH
yann@2438
    36
 
yann@2438
    37
 # We have to have some directories in the library path.
yann@2438
    38
-LIBPATH=$codir:$codir/iconvdata
yann@2438
    39
+LIBPATH=$codir:$codir/iconvdata:$codir/dlfcn
yann@2438
    40
 
yann@2438
    41
 # How the start the iconv(1) program.
yann@2438
    42
 ICONV='$codir/elf/ld.so --library-path $LIBPATH --inhibit-rpath ${from}.so \
yann@2438
    43
diff -durN glibc-2.13.orig/iconvdata/tst-table.sh glibc-2.13/iconvdata/tst-table.sh
yann@2438
    44
--- glibc-2.13.orig/iconvdata/tst-table.sh	2002-04-24 23:39:35.000000000 +0200
yann@2438
    45
+++ glibc-2.13/iconvdata/tst-table.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
    46
@@ -59,8 +59,11 @@
yann@2438
    47
   irreversible=${charset}.irreversible
yann@2438
    48
 fi
yann@2438
    49
 
yann@2438
    50
+# make sure libdl is also in path in case sandbox is in use
yann@2438
    51
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
    52
+
yann@2438
    53
 # iconv in one direction.
yann@2438
    54
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
yann@2438
    55
+${common_objpfx}elf/ld.so --library-path $library_path \
yann@2438
    56
 ${objpfx}tst-table-from ${charset} \
yann@2438
    57
   > ${objpfx}tst-${charset}.table
yann@2438
    58
 
yann@2438
    59
diff -durN glibc-2.13.orig/intl/tst-codeset.sh glibc-2.13/intl/tst-codeset.sh
yann@2438
    60
--- glibc-2.13.orig/intl/tst-codeset.sh	2005-04-06 04:18:35.000000000 +0200
yann@2438
    61
+++ glibc-2.13/intl/tst-codeset.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
    62
@@ -37,6 +37,9 @@
yann@2438
    63
 LOCPATH=${common_objpfx}localedata
yann@2438
    64
 export LOCPATH
yann@2438
    65
 
yann@2438
    66
+# make sure libdl is also in path in case sandbox is in use
yann@2438
    67
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
    68
+
yann@2438
    69
 ${common_objpfx}elf/ld.so --library-path $common_objpfx \
yann@2438
    70
 ${objpfx}tst-codeset > ${objpfx}tst-codeset.out
yann@2438
    71
 
yann@2438
    72
diff -durN glibc-2.13.orig/intl/tst-gettext.sh glibc-2.13/intl/tst-gettext.sh
yann@2438
    73
--- glibc-2.13.orig/intl/tst-gettext.sh	2004-08-15 21:28:18.000000000 +0200
yann@2438
    74
+++ glibc-2.13/intl/tst-gettext.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
    75
@@ -51,9 +51,12 @@
yann@2438
    76
 LOCPATH=${common_objpfx}localedata
yann@2438
    77
 export LOCPATH
yann@2438
    78
 
yann@2438
    79
+# make sure libdl is also in path in case sandbox is in use
yann@2438
    80
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
    81
+
yann@2438
    82
 # Now run the test.
yann@2438
    83
 MALLOC_TRACE=$malloc_trace LOCPATH=${objpfx}localedir:$LOCPATH \
yann@2438
    84
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
yann@2438
    85
+${common_objpfx}elf/ld.so --library-path $library_path \
yann@2438
    86
 ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
yann@2438
    87
 
yann@2438
    88
 exit $?
yann@2438
    89
diff -durN glibc-2.13.orig/intl/tst-gettext2.sh glibc-2.13/intl/tst-gettext2.sh
yann@2438
    90
--- glibc-2.13.orig/intl/tst-gettext2.sh	2005-05-04 19:54:48.000000000 +0200
yann@2438
    91
+++ glibc-2.13/intl/tst-gettext2.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
    92
@@ -65,8 +65,11 @@
yann@2438
    93
 LOCPATH=${objpfx}domaindir
yann@2438
    94
 export LOCPATH
yann@2438
    95
 
yann@2438
    96
+# make sure libdl is also in path in case sandbox is in use
yann@2438
    97
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
    98
+
yann@2438
    99
 # Now run the test.
yann@2438
   100
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
yann@2438
   101
+${common_objpfx}elf/ld.so --library-path $library_path \
yann@2438
   102
 ${objpfx}tst-gettext2 > ${objpfx}tst-gettext2.out ${objpfx}domaindir &&
yann@2438
   103
 cmp ${objpfx}tst-gettext2.out - <<EOF
yann@2438
   104
 String1 - Lang1: 1st string
yann@2438
   105
diff -durN glibc-2.13.orig/intl/tst-translit.sh glibc-2.13/intl/tst-translit.sh
yann@2438
   106
--- glibc-2.13.orig/intl/tst-translit.sh	2005-05-04 19:56:10.000000000 +0200
yann@2438
   107
+++ glibc-2.13/intl/tst-translit.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
   108
@@ -36,7 +36,10 @@
yann@2438
   109
 LOCPATH=${common_objpfx}localedata
yann@2438
   110
 export LOCPATH
yann@2438
   111
 
yann@2438
   112
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
yann@2438
   113
+# make sure libdl is also in path in case sandbox is in use
yann@2438
   114
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
   115
+
yann@2438
   116
+${common_objpfx}elf/ld.so --library-path $library_path \
yann@2438
   117
 ${objpfx}tst-translit > ${objpfx}tst-translit.out ${objpfx}domaindir
yann@2438
   118
 
yann@2438
   119
 exit $?
yann@2438
   120
diff -durN glibc-2.13.orig/malloc/tst-mtrace.sh glibc-2.13/malloc/tst-mtrace.sh
yann@2438
   121
--- glibc-2.13.orig/malloc/tst-mtrace.sh	2005-10-15 01:40:35.000000000 +0200
yann@2438
   122
+++ glibc-2.13/malloc/tst-mtrace.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
   123
@@ -24,9 +24,12 @@
yann@2438
   124
 status=0
yann@2438
   125
 trap "rm -f ${common_objpfx}malloc/tst-mtrace.leak; exit 1" 1 2 15
yann@2438
   126
 
yann@2438
   127
+# make sure libdl is also in path in case sandbox is in use
yann@2438
   128
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
   129
+
yann@2438
   130
 MALLOC_TRACE=${common_objpfx}malloc/tst-mtrace.leak \
yann@2438
   131
 LOCPATH=${common_objpfx}localedata GCONV_PATH=${common_objpfx}iconvdata \
yann@2438
   132
-${common_objpfx}elf/ld.so --library-path $common_objpfx \
yann@2438
   133
+${common_objpfx}elf/ld.so --library-path $library_path \
yann@2438
   134
   ${common_objpfx}malloc/tst-mtrace || status=1
yann@2438
   135
 
yann@2438
   136
 if test $status -eq 0 && test -f ${common_objpfx}malloc/mtrace; then
yann@2438
   137
diff -durN glibc-2.13.orig/nptl/tst-tls6.sh glibc-2.13/nptl/tst-tls6.sh
yann@2438
   138
--- glibc-2.13.orig/nptl/tst-tls6.sh	2003-09-03 00:02:59.000000000 +0200
yann@2438
   139
+++ glibc-2.13/nptl/tst-tls6.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
   140
@@ -5,8 +5,8 @@
yann@2438
   141
 rtld_installed_name=$1; shift
yann@2438
   142
 logfile=$common_objpfx/nptl/tst-tls6.out
yann@2438
   143
 
yann@2438
   144
-# We have to find libc and nptl
yann@2438
   145
-library_path=${common_objpfx}:${common_objpfx}nptl
yann@2438
   146
+# We have to find libc and nptl (also libdl in case sandbox is in use)
yann@2438
   147
+library_path=${common_objpfx}:${common_objpfx}nptl:${common_objpfx}/dlfcn
yann@2438
   148
 tst_tls5="${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
yann@2438
   149
 	  ${common_objpfx}/nptl/tst-tls5"
yann@2438
   150
 
yann@2438
   151
diff -durN glibc-2.13.orig/posix/globtest.sh glibc-2.13/posix/globtest.sh
yann@2438
   152
--- glibc-2.13.orig/posix/globtest.sh	2008-12-06 07:05:39.000000000 +0100
yann@2438
   153
+++ glibc-2.13/posix/globtest.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
   154
@@ -18,7 +18,7 @@
yann@2438
   155
 esac
yann@2438
   156
 
yann@2438
   157
 # We have to find the libc and the NSS modules.
yann@2438
   158
-library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod
yann@2438
   159
+library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis:${common_objpfx}db2:${common_objpfx}hesiod:${common_objpfx}/dlfcn
yann@2438
   160
 
yann@2438
   161
 # Since we use `sort' we must make sure to use the same locale everywhere.
yann@2438
   162
 LC_ALL=C
yann@2438
   163
diff -durN glibc-2.13.orig/posix/tst-getconf.sh glibc-2.13/posix/tst-getconf.sh
yann@2438
   164
--- glibc-2.13.orig/posix/tst-getconf.sh	2002-09-01 13:11:25.000000000 +0200
yann@2438
   165
+++ glibc-2.13/posix/tst-getconf.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
   166
@@ -10,7 +10,10 @@
yann@2438
   167
 else
yann@2438
   168
   rtld_installed_name=$1; shift
yann@2438
   169
   runit() {
yann@2438
   170
-    ${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} "$@"
yann@2438
   171
+    
yann@2438
   172
+  # make sure libdl is also in path in case sandbox is in use
yann@2438
   173
+  library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
   174
+    ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} "$@"
yann@2438
   175
   }
yann@2438
   176
 fi
yann@2438
   177
 
yann@2438
   178
diff -durN glibc-2.13.orig/posix/wordexp-tst.sh glibc-2.13/posix/wordexp-tst.sh
yann@2438
   179
--- glibc-2.13.orig/posix/wordexp-tst.sh	2000-10-20 18:23:30.000000000 +0200
yann@2438
   180
+++ glibc-2.13/posix/wordexp-tst.sh	2009-11-13 00:50:37.000000000 +0100
yann@2438
   181
@@ -19,8 +19,11 @@
yann@2438
   182
 "
yann@2438
   183
 export IFS
yann@2438
   184
 
yann@2438
   185
+# make sure libdl is also in path in case sandbox is in use
yann@2438
   186
+library_path=${common_objpfx}:${common_objpfx}/dlfcn
yann@2438
   187
+
yann@2438
   188
 failed=0
yann@2438
   189
-${elf_objpfx}${rtld_installed_name} --library-path ${common_objpfx} \
yann@2438
   190
+${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
yann@2438
   191
 ${common_objpfx}posix/wordexp-test '$*' > ${testout}1
yann@2438
   192
 cat <<"EOF" | cmp - ${testout}1 >> $logfile || failed=1
yann@2438
   193
 wordexp returned 0