aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@gentoo.org>2019-09-07 21:17:52 +0100
committerSergei Trofimovich <slyfox@gentoo.org>2019-09-07 22:29:12 +0100
commit44570a44be60a8fc33bd05089047c1f2980b3047 (patch)
treed0ce8fe2aa6b3316f5ec53090d1cd560d56af26d /gcc-config
parentMakefile: drop C*FLAGS from Makefile as gcc-wrapper is no more (diff)
downloadgcc-config-44570a44be60a8fc33bd05089047c1f2980b3047.tar.gz
gcc-config-44570a44be60a8fc33bd05089047c1f2980b3047.tar.bz2
gcc-config-44570a44be60a8fc33bd05089047c1f2980b3047.zip
gcc-config: store gcc backup into /lib/gcc-backup, not /lib
Writing (and removing) libraries to /lib outside package manager was a surprise to users in bug #667020# where libunwind.so was clobbered by gcc-config runs. This change isolates all logic that handles file copies outside package manager into /lib/gcc-backup directory. To make new library still resolveable we install env.d entry with contents of LDPATH="/lib/gcc-backup" Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'gcc-config')
-rwxr-xr-xgcc-config17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc-config b/gcc-config
index 01e2b90..65b30bc 100755
--- a/gcc-config
+++ b/gcc-config
@@ -42,6 +42,9 @@ PV="@PV@"
GENTOO_LIBDIR="@GENTOO_LIBDIR@"
[[ ${GENTOO_LIBDIR} == @*@ ]] && GENTOO_LIBDIR="lib"
+GENTOO_GCC_BACKUP_DIR="@GENTOO_GCC_BACKUP_DIR@"
+[[ ${GENTOO_GCC_BACKUP_DIR} == @*@ ]] && GENTOO_GCC_BACKUP_DIR="gcc-backup"
+
usage() {
cat <<-EOF
Usage: gcc-config [options] [CC Profile]
@@ -316,11 +319,23 @@ handle_split_usr() {
if is_same_mountpoint "${EROOT}/lib" "${ROOT}/${LDPATH}" ; then
local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
shopt -s nullglob
+
+ # We relied on these copies until Sept 2019.
+ # Can be removed in 2021.
for lib in "${EROOT}"/lib*/libgcc_s{.so*,*dylib} "${EROOT}"/lib*/libunwind.so.7* ; do
# If we previously had stuff in /, make sure ldconfig gets re-run.
rm -f "${lib}"
old_libs=1
done
+
+ for lib in \
+ "${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libgcc_s.so.* \
+ "${EROOT}"/lib*/"${GENTOO_GCC_BACKUP_DIR}"/libunwind.so.* ; do
+ # If we previously had stuff in /, make sure ldconfig gets re-run.
+ rm -f "${lib}"
+ old_libs=1
+ done
+
${saved_nullglob}
return ${old_libs}
fi
@@ -328,7 +343,7 @@ handle_split_usr() {
# Only bother with this stuff for the native ABI. We assume the user
# doesn't have critical binaries for non-native ABIs which is fair.
local gcclib
- local libdir="${EROOT}${GENTOO_LIBDIR}"
+ local libdir="${EROOT}/${GENTOO_LIBDIR}/${GENTOO_GCC_BACKUP_DIR}"
mkdir -p "${libdir}"/.gcc.config.new || return 0 # !?!?!
for gcclib in gcc_s unwind ; do
# This assumes that we always have the .so symlink,