From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3B9C0138334 for ; Fri, 6 Sep 2019 06:53:44 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4EBCBE0819; Fri, 6 Sep 2019 06:53:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 1F352E0819 for ; Fri, 6 Sep 2019 06:53:43 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B44A834AD39 for ; Fri, 6 Sep 2019 06:53:41 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 310CA6FE for ; Fri, 6 Sep 2019 06:53:39 +0000 (UTC) From: "Sergei Trofimovich" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sergei Trofimovich" Message-ID: <1567752790.4e5b7557ea50bc7e6b037e67ac222fb65766646d.slyfox@gentoo> Subject: [gentoo-commits] proj/gcc-config:master commit in: / X-VCS-Repository: proj/gcc-config X-VCS-Files: gcc-config X-VCS-Directories: / X-VCS-Committer: slyfox X-VCS-Committer-Name: Sergei Trofimovich X-VCS-Revision: 4e5b7557ea50bc7e6b037e67ac222fb65766646d X-VCS-Branch: master Date: Fri, 6 Sep 2019 06:53:39 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 46ac9c12-ee89-45ca-a8fe-004177263730 X-Archives-Hash: fb5a372959cd8f649f06649a1e7e90c7 commit: 4e5b7557ea50bc7e6b037e67ac222fb65766646d Author: Arfrever Frehtes Taifersar Arahesis Apache Org> AuthorDate: Fri Sep 6 00:59:02 2019 +0000 Commit: Sergei Trofimovich gentoo org> CommitDate: Fri Sep 6 06:53:10 2019 +0000 URL: https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=4e5b7557 gcc-config: Use findmnt for mountpoint check when available. Closes: https://bugs.gentoo.org/693588 Signed-off-by: Arfrever Frehtes Taifersar Arahesis Apache.Org> Signed-off-by: Sergei Trofimovich gentoo.org> gcc-config | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/gcc-config b/gcc-config index 9e5abf8..169f8bc 100755 --- a/gcc-config +++ b/gcc-config @@ -145,6 +145,37 @@ is_cross_compiler() { [[ ${CC_COMP/${CHOST}} == ${CC_COMP} ]] } +is_same_mountpoint() { + local file1=$1 file2=$2 + + if type -P findmnt > /dev/null ; then + local file1_mountpoint=$(findmnt -n -o TARGET -T "${file1}") + local file2_mountpoint=$(findmnt -n -o TARGET -T "${file2}") + + [[ ${file1_mountpoint} == ${file2_mountpoint} ]] + return + else + local file1_check_file file2_check_file result + if [[ -d ${file1} ]] ; then + file1_check_file=${file1}/.gcc.config.mountpoint_check_file1.$$ + else + file1_check_file=${file1%/*}/.gcc.config.mountpoint_check_file1.$$ + fi + if [[ -d ${file2} ]] ; then + file2_check_file=${file2}/.gcc.config.mountpoint_check_file2.$$ + else + file2_check_file=${file2%/*}/.gcc.config.mountpoint_check_file2.$$ + fi + + rm -f "${file1_check_file}" "${file2_check_file}" + touch "${file1_check_file}" + ln "${file1_check_file}" "${file2_check_file}" 2> /dev/null + result=$? + rm -f "${file1_check_file}" "${file2_check_file}" + return ${result} + fi +} + # Usage: atomic_ln atomic_ln() { local src=$1 dst=$2 dstfile=$3 tmp @@ -277,13 +308,11 @@ handle_split_usr() { # We use the same ordering logic as mentioned in the MY_LDPATH setup. # We get the libs from the latest version available. local LDPATH - eval $(grep -h '^LDPATH=' "${GCC_ENV_D}"/${CHOST}-* | tail -1) LDPATH=${LDPATH%%:*} - # 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 GCC directory is not in separate mountpoint than /lib, then do not bother with copying libraries to /lib. + if is_same_mountpoint "${EROOT}/lib" "${ROOT}/${LDPATH}" ; 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