From patchwork Fri Sep 30 10:09:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 676948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3slnHg6blYz9s1h for ; Fri, 30 Sep 2016 20:10:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 52C4495512; Fri, 30 Sep 2016 10:10:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id etOdpAaWBIy2; Fri, 30 Sep 2016 10:10:04 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B9BB395516; Fri, 30 Sep 2016 10:10:04 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 15A281C1774 for ; Fri, 30 Sep 2016 10:10:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 17B249215D for ; Fri, 30 Sep 2016 10:10:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3rhqBYt7qKEK for ; Fri, 30 Sep 2016 10:09:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lupi.sysmic.org (sysmic.org [62.210.89.17]) by whitealder.osuosl.org (Postfix) with ESMTPS id 225449218B for ; Fri, 30 Sep 2016 10:09:59 +0000 (UTC) Received: from lupi.online.net (sysmic.org [62.210.89.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jezz) by lupi.sysmic.org (Postfix) with ESMTPSA id 176A2444C0; Fri, 30 Sep 2016 12:09:57 +0200 (CEST) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= To: buildroot@busybox.net Date: Fri, 30 Sep 2016 12:09:53 +0200 Message-Id: <1475230194-18524-2-git-send-email-jezz@sysmic.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1475230194-18524-1-git-send-email-jezz@sysmic.org> References: <1475230194-18524-1-git-send-email-jezz@sysmic.org> MIME-Version: 1.0 Cc: =?UTF-8?q?J=C3=A9r=C3=B4me=20Pouiller?= Subject: [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" If compilation path contains symlinks, rpath may sometime contains symlinks and sometime canonicalized path. A pratical example: $ ln -s /opt/buildroot /opt/buildroot-symblink $ cd /opt/buildroot-symlink $ make O=out $ make -C out package-rebuild This last command produce an error since already installed host binaries contains /opt/buildroot/out/host/usr/lib as rpath while check-host-rpath expect /opt/buildroot-symlink/out/host/usr/lib This patch canonicalize all paths used in check-host-rpath in order to avoid problem Signed-off-by: Jérôme Pouiller --- support/scripts/check-host-rpath | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath index 6ce547c..2541e53 100755 --- a/support/scripts/check-host-rpath +++ b/support/scripts/check-host-rpath @@ -13,8 +13,8 @@ main() { local hostdir="${2}" local file ret - # Remove duplicate and trailing '/' for proper match - hostdir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${hostdir}" )" + # Canonicalize path: follow symlinks, remove duplicate and trailing '/' + hostdir="$( readlink -m "${hostdir}" )" ret=0 while read file; do @@ -56,8 +56,8 @@ check_elf_has_rpath() { while read rpath; do for dir in ${rpath//:/ }; do - # Remove duplicate and trailing '/' for proper match - dir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${dir}" )" + # Canonicalize path: follow symlinks, remove duplicate and trailing '/' + dir="$( readlink -m "${dir}" )" [ "${dir}" = "${hostdir}/usr/lib" ] && return 0 done done < <( readelf -d "${file}" \