commit:     ff954c6b20686d490d1382f90d2a4d64754bb18e
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Wed Sep  4 19:29:58 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Thu Sep  5 06:28:11 2019 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=ff954c6b

gcc-config: During initial clean-up, delete only libunwind.so.7*, but not other 
files matching libunwind.so*.

libunwind.so belongs to sys-libs/libunwind.
libunwind.so.7* is copied by gcc-config (only on ia64) from active version of 
sys-devel/gcc.
libunwind.so.8* belong to sys-libs/libunwind since 1.0.1 version released on 
2011-09-11.

[slyfox@: sumplified 'return' statement]
Bug: https://bugs.gentoo.org/667020
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>

 gcc-config | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gcc-config b/gcc-config
index 835f873..34ff3e0 100755
--- a/gcc-config
+++ b/gcc-config
@@ -1,5 +1,5 @@
 #!/bin/bash
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 2002-2019 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Format of /etc/env.d/gcc/:
@@ -286,7 +286,7 @@ handle_split_usr() {
        # but on other systems (arm/mips/etc...), this is quite critical.
        # http://bugs.gentoo.org/60190
        #
-       # Note: libunwind.so is is a DT_NEEDED dependency only on ia64 systems
+       # Note: libunwind.so.7 is a DT_NEEDED dependency only on ia64 systems
        # where libunwind.so.7 is provided by gcc itself, see:
        #    https://bugs.gentoo.org/667020
        #    https://bugs.gentoo.org/693252
@@ -306,12 +306,15 @@ handle_split_usr() {
        # If /usr isn't a sep mount, then don't bother with linking stuff.
        if ln "${ROOT}/${LDPATH}/libgcc.a" "${EROOT}"/lib/.gcc.config.$$ 
2>/dev/null ; then
                rm -f "${EROOT}"/lib/.gcc.config.$$
-               if [[ -n $(find "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib} 
2>/dev/null) ]] ; then
+               local lib old_libs=0 saved_nullglob=$(shopt -p nullglob)
+               shopt -s nullglob
+               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 "${EROOT}"/lib*/lib{gcc_s,unwind}{.so*,*dylib}
-                       return 1
-               fi
-               return 0
+                       rm -f "${lib}"
+                       old_libs=1
+               done
+               ${saved_nullglob}
+               return ${old_libs}
        fi
 
        # Only bother with this stuff for the native ABI.  We assume the user

Reply via email to