patches/glibc/2.9/400-tests-sandbox-libdl-paths.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Jan 17 23:06:02 2010 +0100 (2010-01-17)
changeset 1740 c57458bb354d
parent 1201 c9967a6e3b25
permissions -rw-r--r--
configure: do not require hg when configuring in an hg clone

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