blob: 8b2998ef9818ad932bfe5d3c58cfe5c29f460d38 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/files/eblits/pkg_preinst.eblit,v 1.4 2011/11/16 16:07:46 vapier Exp $
fix_lib64_symlinks() {
# the original Gentoo/AMD64 devs decided that since 64bit is the native
# bitdepth for AMD64, lib should be used for 64bit libraries. however,
# this ignores the FHS and breaks multilib horribly... especially
# since it wont even work without a lib64 symlink anyways. *rolls eyes*
# see bug 59710 for more information.
# Travis Tilley <lv@gentoo.org> (08 Aug 2004)
if [ -L ${ROOT}/lib64 ] ; then
ewarn "removing /lib64 symlink and moving lib to lib64..."
ewarn "dont hit ctrl-c until this is done"
rm ${ROOT}/lib64
# now that lib64 is gone, nothing will run without calling ld.so
# directly. luckily the window of brokenness is almost non-existant
use amd64 && /lib/ld-linux-x86-64.so.2 /bin/mv ${ROOT}/lib ${ROOT}/lib64
use ppc64 && /lib/ld64.so.1 /bin/mv ${ROOT}/lib ${ROOT}/lib64
# all better :)
ldconfig
ln -s lib64 ${ROOT}/lib
einfo "done! :-)"
einfo "fixed broken lib64/lib symlink in ${ROOT}"
fi
if [ -L ${ROOT}/usr/lib64 ] ; then
rm ${ROOT}/usr/lib64
mv ${ROOT}/usr/lib ${ROOT}/usr/lib64
ln -s lib64 ${ROOT}/usr/lib
einfo "fixed broken lib64/lib symlink in ${ROOT}/usr"
fi
if [ -L ${ROOT}/usr/X11R6/lib64 ] ; then
rm ${ROOT}/usr/X11R6/lib64
mv ${ROOT}/usr/X11R6/lib ${ROOT}/usr/X11R6/lib64
ln -s lib64 ${ROOT}/usr/X11R6/lib
einfo "fixed broken lib64/lib symlink in ${ROOT}/usr/X11R6"
fi
}
eblit-glibc-pkg_preinst() {
# nothing to do if just installing headers
just_headers && return
# PPC64+others may want to eventually be added to this logic if they
# decide to be multilib compatible and FHS compliant. note that this
# chunk of FHS compliance only applies to 64bit archs where 32bit
# compatibility is a major concern (not IA64, for example).
# amd64's 2005.0 is the first amd64 profile to not need this code.
# 2005.0 is setup properly, and this is executed as part of the
# 2004.3 -> 2005.0 upgrade script.
# It can be removed after 2004.3 has been purged from portage.
{ use amd64 || use ppc64; } && [ "$(get_libdir)" == "lib64" ] && ! has_multilib_profile && fix_lib64_symlinks
# prepare /etc/ld.so.conf.d/ for files
mkdir -p "${ROOT}"/etc/ld.so.conf.d
# 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.
[[ ${ROOT} != "/" ]] && return 0
[[ -d ${D}/$(get_libdir) ]] || return 0
cd / #228809
local x striptest
for x in date env ls true uname ; do
x=$(type -p ${x})
[[ -z ${x} ]] && continue
striptest=$(LC_ALL="C" file -L ${x} 2>/dev/null)
[[ -z ${striptest} ]] && continue
[[ ${striptest} == *"statically linked"* ]] && continue
# we enter ${D} 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 "${D}"/$(get_libdir) 2>/dev/null
./ld-*.so --library-path . ${x} > /dev/null \
|| die "simple run test (${x}) failed"
popd 2>/dev/null
done
}
|