patches/glibc/2.9/400-tests-sandbox-libdl-paths.patch
author Titus von Boxberg <titus@v9g.de>
Tue Nov 06 17:02:06 2012 +0100 (2012-11-06)
changeset 3103 a8bf927f6e37
parent 1201 c9967a6e3b25
permissions -rw-r--r--
Makefile.in: Use only standard options compatible with BSD install

Don't use options specific to FSF's coreutils install.

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