Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Jérôme Pouiller" <jezz@sysmic.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath
Date: Fri, 30 Sep 2016 12:09:53 +0200	[thread overview]
Message-ID: <1475230194-18524-2-git-send-email-jezz@sysmic.org> (raw)
In-Reply-To: <1475230194-18524-1-git-send-email-jezz@sysmic.org>

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 <jezz@sysmic.org>
---
 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}"                                              \
-- 
1.9.1

  reply	other threads:[~2016-09-30 10:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-30 10:09 [Buildroot] [PATCH 0/2] Symlinks in compilation path confuse check-host-rpath Jérôme Pouiller
2016-09-30 10:09 ` Jérôme Pouiller [this message]
2016-10-04 21:33   ` [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath Arnout Vandecappelle
2016-10-05  8:54     ` Jérôme Pouiller
2016-10-16 10:58       ` Arnout Vandecappelle
2016-10-16 11:43         ` Samuel Martin
2016-09-30 10:09 ` [Buildroot] [PATCH 2/2] Canonicalize $(BASE_DIR) Jérôme Pouiller
2016-10-03 21:21 ` [Buildroot] [PATCH 0/2] Symlinks in compilation path confuse check-host-rpath Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475230194-18524-2-git-send-email-jezz@sysmic.org \
    --to=jezz@sysmic.org \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox