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