/[gentoo-x86]/sys-libs/glibc/files/eblits/pkg_preinst.eblit
Gentoo

Diff of /sys-libs/glibc/files/eblits/pkg_preinst.eblit

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.7
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.6 2012/10/02 07:12:17 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.7 2013/01/25 03:12:18 vapier Exp $
4
5# Simple test to make sure our new glibc isnt completely broken.
6# Make sure we don't test with statically built binaries since
7# they will fail. Also, skip if this glibc is a cross compiler.
8glibc_sanity_check() {
9 cd / #228809
10
11 # We also might have to search the gcc dir for things like libgcc_s.so #453760
12 local gccdir=$(ls -1rd /usr/lib/gcc/${CHOST}/*/ | head -1)
13
14 # We enter ${D} so to avoid trouble if the path contains
15 # special characters; for instance if the path contains the
16 # colon character (:), then the linker will try to split it
17 # and look for the libraries in an unexpected place. This can
18 # lead to unsafe code execution if the generated prefix is
19 # within a world-writable directory.
20 # (e.g. /var/tmp/portage:${HOSTNAME})
21 pushd "${D}"/$(get_libdir) >/dev/null
22
23 local x striptest
24 for x in date env ls true uname ; do
25 x=$(type -p ${x})
26 [[ -z ${x} ]] && continue
27 striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
28 [[ ${striptest} == *"statically linked"* ]] && continue
29 ./ld-*.so --library-path ".:${gccdir}" ${x} > /dev/null \
30 || die "simple run test (${x}) failed"
31 done
32
33 popd >/dev/null
34}
4 35
5eblit-glibc-pkg_preinst() { 36eblit-glibc-pkg_preinst() {
6 # nothing to do if just installing headers 37 # nothing to do if just installing headers
7 just_headers && return 38 just_headers && return
8 39
13 if [[ $(wc -l < "${ROOT}"/etc/hosts) -lt 1000 ]] ; then 44 if [[ $(wc -l < "${ROOT}"/etc/hosts) -lt 1000 ]] ; then
14 sed -i '/^multi off/s:off:on:' "${D}"/etc/host.conf 45 sed -i '/^multi off/s:off:on:' "${D}"/etc/host.conf
15 elog "Defaulting /etc/host.conf:multi to on" 46 elog "Defaulting /etc/host.conf:multi to on"
16 fi 47 fi
17 48
18 # simple test to make sure our new glibc isnt completely broken.
19 # make sure we don't test with statically built binaries since
20 # they will fail. also, skip if this glibc is a cross compiler.
21 [[ ${ROOT} != "/" ]] && return 0 49 [[ ${ROOT} != "/" ]] && return 0
22 [[ -d ${D}/$(get_libdir) ]] || return 0 50 [[ -d ${D}/$(get_libdir) ]] || return 0
23 cd / #228809 51 glibc_sanity_check
24 local x striptest
25 for x in date env ls true uname ; do
26 x=$(type -p ${x})
27 [[ -z ${x} ]] && continue
28 striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null)
29 [[ -z ${striptest} ]] && continue
30 [[ ${striptest} == *"statically linked"* ]] && continue
31 # we enter ${D} so to avoid trouble if the path contains
32 # special characters; for instance if the path contains the
33 # colon character (:), then the linker will try to split it
34 # and look for the libraries in an unexpected place. This can
35 # lead to unsafe code execution if the generated prefix is
36 # within a world-writable directory
37 # (e.g. /var/tmp/portage:${HOSTNAME})
38 pushd "${D}"/$(get_libdir) 2>/dev/null
39 ./ld-*.so --library-path . ${x} > /dev/null \
40 || die "simple run test (${x}) failed"
41 popd 2>/dev/null
42 done
43} 52}

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.20