blob: a7975e296659a44a68c216f1ca63da1d82c5eab1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# Simple test to make sure our new glibc isnt completely broken.
# Make sure we don't test with statically built binaries since
# they will fail. Also, skip if this glibc is a cross compiler.
#
# If coreutils is built with USE=multicall, some of these files
# will just be wrapper scripts, not actual ELFs we can test.
glibc_sanity_check() {
cd / #228809
# We enter ${ED} so to avoid trouble if the path contains
# special characters; for instance if the path contains the
# colon character (:), then the linker will try to split it
# and look for the libraries in an unexpected place. This can
# lead to unsafe code execution if the generated prefix is
# within a world-writable directory.
# (e.g. /var/tmp/portage:${HOSTNAME})
pushd "${ED}"/$(get_libdir) >/dev/null
local x striptest
for x in cal date env free ls true uname uptime ; do
x=$(type -p ${x})
[[ -z ${x} || ${x} != ${EPREFIX}/* ]] && continue
striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null) || continue
case ${striptest} in
*"statically linked"*) continue;;
*"ASCII text"*) continue;;
esac
# We need to clear the locale settings as the upgrade might want
# incompatible locale data. This test is not for verifying that.
LC_ALL=C \
./ld-*.so --library-path . ${x} > /dev/null \
|| die "simple run test (${x}) failed"
done
popd >/dev/null
}
eblit-glibc-pkg_preinst() {
# nothing to do if just installing headers
just_headers && return
# prepare /etc/ld.so.conf.d/ for files
mkdir -p "${EROOT}"/etc/ld.so.conf.d
# Default /etc/hosts.conf:multi to on for systems with small dbs.
if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
elog "Defaulting /etc/host.conf:multi to on"
fi
[[ ${ROOT} != "/" ]] && return 0
[[ -d ${ED}/$(get_libdir) ]] || return 0
[[ -z ${BOOTSTRAP_RAP} ]] && glibc_sanity_check
# For newer EAPIs, this was run in pkg_pretend.
if [[ ${EAPI:-0} == [0123] ]] ; then
check_devpts
fi
}
|