PageRenderTime 2814ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/patches/glibc/ports-2.13/360-tests-sandbox-libdl-paths.patch

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