diff mbox

[RFC,8/9] support/scripts: check-host-rpath now handles $ORIGIN as well

Message ID 1488550733-3956-9-git-send-email-wg@grandegger.com
State Superseded
Headers show

Commit Message

Wolfgang Grandegger March 3, 2017, 2:18 p.m. UTC
$ORIGIN/../../usr/bin is also a valid rpath for binaries in
"$hostdir/usr/bin".

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
---
 support/scripts/check-host-rpath | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Thomas Petazzoni March 3, 2017, 2:46 p.m. UTC | #1
Hello,

On Fri,  3 Mar 2017 15:18:52 +0100, Wolfgang Grandegger wrote:
> $ORIGIN/../../usr/bin is also a valid rpath for binaries in
> "$hostdir/usr/bin".

I guess you meant $ORIGIN/../../usr/lib and $hostdir/usr/lib here,
right?

Isn't this patch 8/9 actually a fix, which should come first in the
series, and that we could/should apply quickly, independent from the
rest?

Thanks,

Thomas
Wolfgang Grandegger March 3, 2017, 2:56 p.m. UTC | #2
Hello,

Am 03.03.2017 um 15:46 schrieb Thomas Petazzoni:
> Hello,
>
> On Fri,  3 Mar 2017 15:18:52 +0100, Wolfgang Grandegger wrote:
>> $ORIGIN/../../usr/bin is also a valid rpath for binaries in
>> "$hostdir/usr/bin".
>
> I guess you meant $ORIGIN/../../usr/lib and $hostdir/usr/lib here,
> right?

"$ORIGIN/../../usr/lib" in ELF files in "$hostdir/usr/bin" *or* 
"$hostdir/usr/lib". IIRC, I think the problem was with some binaries in 
"usr/bin".

> Isn't this patch 8/9 actually a fix, which should come first in the
> series, and that we could/should apply quickly, independent from the
> rest?

Yes! I got it after an initial build. Can't remember what package made 
the problem. Going to a fresh re-make...

Wolfgang.
Wolfgang Grandegger March 3, 2017, 5:12 p.m. UTC | #3
Hello,

Am 03.03.2017 um 15:56 schrieb Wolfgang Grandegger:
> Hello,
>
> Am 03.03.2017 um 15:46 schrieb Thomas Petazzoni:
>> Hello,
>>
>> On Fri,  3 Mar 2017 15:18:52 +0100, Wolfgang Grandegger wrote:
>>> $ORIGIN/../../usr/bin is also a valid rpath for binaries in
>>> "$hostdir/usr/bin".
>>
>> I guess you meant $ORIGIN/../../usr/lib and $hostdir/usr/lib here,
>> right?
>
> "$ORIGIN/../../usr/lib" in ELF files in "$hostdir/usr/bin" *or*
> "$hostdir/usr/lib". IIRC, I think the problem was with some binaries in
> "usr/bin".
>
>> Isn't this patch 8/9 actually a fix, which should come first in the
>> series, and that we could/should apply quickly, independent from the
>> rest?
>
> Yes! I got it after an initial build. Can't remember what package made
> the problem. Going to a fresh re-make...

That's not correct. At the *second* make I get:

*** ERROR: package host-libxml-parser-perl installs executables without 
proper RPATH:
***   /work/agco/output/dcu_host/host/usr/bin/gtester
***   /work/agco/output/dcu_host/host/usr/bin/xgettext
***   /work/agco/output/dcu_host/host/usr/bin/msgexec
***   /work/agco/output/dcu_host/host/usr/bin/msggrep
***   /work/agco/output/dcu_host/host/usr/bin/msgcat
***   /work/agco/output/dcu_host/host/usr/bin/toe
***   /work/agco/output/dcu_host/host/usr/bin/msgconv
***   /work/agco/output/dcu_host/host/usr/bin/infocmp

In my case, this is due to the sanitized rpath from the previous make. 
With my config there is no ELF file with an initial rpath 
"$ORIGIN/../../usr/lib". Well, this check is not necessary at all after 
rpath sanitation. I'm going to remove it in my patch series.

Wolfgang.
diff mbox

Patch

diff --git a/support/scripts/check-host-rpath b/support/scripts/check-host-rpath
index 6ce547c..020c123 100755
--- a/support/scripts/check-host-rpath
+++ b/support/scripts/check-host-rpath
@@ -58,7 +58,7 @@  check_elf_has_rpath() {
         for dir in ${rpath//:/ }; do
             # Remove duplicate and trailing '/' for proper match
             dir="$( sed -r -e 's:/+:/:g; s:/$::;' <<<"${dir}" )"
-            [ "${dir}" = "${hostdir}/usr/lib" ] && return 0
+            [ "${dir}" = "${hostdir}/usr/lib" -o "${dir}" = "\$ORIGIN/../../usr/lib" ] && return 0
         done
     done < <( readelf -d "${file}"                                              \
               |sed -r -e '/.* \(R(UN)?PATH\) +Library r(un)?path: \[(.+)\]$/!d' \