All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] Symlinks in compilation path confuse check-host-rpath
@ 2016-09-30 10:09 Jérôme Pouiller
  2016-09-30 10:09 ` [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath Jérôme Pouiller
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jérôme Pouiller @ 2016-09-30 10:09 UTC (permalink / raw)
  To: buildroot

If user do:

      $ ln -s /opt/buildroot /opt/buildroot-symblink
      $ cd /opt/buildroot-symlink
      $ make O=out
      $ make -C out package-rebuild

the 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

These two patch solve this issue. First patch only fix check-host-rpath. However,
other tools may be impacted by this issue, so I wrote a second patch to use
canonicalized path everywhere.

J?r?me Pouiller (2):
  check-host-rpath: support symlinks in rpath
  Canonicalize $(BASE_DIR)

 Makefile                         | 2 +-
 support/scripts/check-host-rpath | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath
  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
  2016-10-04 21:33   ` Arnout Vandecappelle
  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
  2 siblings, 1 reply; 8+ messages in thread
From: Jérôme Pouiller @ 2016-09-30 10:09 UTC (permalink / raw)
  To: 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 <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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 2/2] Canonicalize $(BASE_DIR)
  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 ` [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath Jérôme Pouiller
@ 2016-09-30 10:09 ` Jérôme Pouiller
  2016-10-03 21:21 ` [Buildroot] [PATCH 0/2] Symlinks in compilation path confuse check-host-rpath Thomas Petazzoni
  2 siblings, 0 replies; 8+ messages in thread
From: Jérôme Pouiller @ 2016-09-30 10:09 UTC (permalink / raw)
  To: buildroot

If compilation path contains symlinks, $(*_DIR) variables does not contains
same values depending if user run 'make O=out' or 'make -C out'.

This patch always canonicalize $(BASE_DIR) to avoid this problem.

Signed-off-by: J?r?me Pouiller <jezz@sysmic.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5e4daef..5c907e5 100644
--- a/Makefile
+++ b/Makefile
@@ -136,7 +136,7 @@ endif
 # line doesn't affect the environment of $(shell ..) calls, so
 # explictly throw away any output from 'cd' here.
 export CDPATH :=
-BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && pwd)
+BASE_DIR := $(shell mkdir -p $(O) && cd $(O) >/dev/null && readlink -m .)
 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
 
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 0/2] Symlinks in compilation path confuse check-host-rpath
  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 ` [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath Jérôme Pouiller
  2016-09-30 10:09 ` [Buildroot] [PATCH 2/2] Canonicalize $(BASE_DIR) Jérôme Pouiller
@ 2016-10-03 21:21 ` Thomas Petazzoni
  2 siblings, 0 replies; 8+ messages in thread
From: Thomas Petazzoni @ 2016-10-03 21:21 UTC (permalink / raw)
  To: buildroot

Hello,

On Fri, 30 Sep 2016 12:09:52 +0200, J?r?me Pouiller wrote:

> J?r?me Pouiller (2):
>   check-host-rpath: support symlinks in rpath
>   Canonicalize $(BASE_DIR)

Samuel, Yann, Arnout, could you help reviewing this patch series?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath
  2016-09-30 10:09 ` [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath Jérôme Pouiller
@ 2016-10-04 21:33   ` Arnout Vandecappelle
  2016-10-05  8:54     ` Jérôme Pouiller
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2016-10-04 21:33 UTC (permalink / raw)
  To: buildroot



On 30-09-16 12:09, J?r?me Pouiller wrote:
> 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

 Wouldn't this also be fixed by http://patchwork.ozlabs.org/patch/613854/ ? With
that patch (series) applied, there shouldn't be any symlinks anymore once the
real make starts.

 Note that I still had remarks on that specific patch and Samuel hasn't respun.
Maybe something for in Berlin.


 Regards,
 Arnout

> 
> 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}"                                              \
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath
  2016-10-04 21:33   ` Arnout Vandecappelle
@ 2016-10-05  8:54     ` Jérôme Pouiller
  2016-10-16 10:58       ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Jérôme Pouiller @ 2016-10-05  8:54 UTC (permalink / raw)
  To: buildroot

Hi Arnout,

On Tuesday 04 October 2016 23:33:34 Arnout Vandecappelle wrote:
> On 30-09-16 12:09, J?r?me Pouiller wrote:
> > 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
> 
>  Wouldn't this also be fixed by
> http://patchwork.ozlabs.org/patch/613854/ ? With that patch (series)
> applied, there shouldn't be any symlinks anymore once the real make
> starts.

I didn't saw Samuel's patch. I will test it soon. I think it supersede 
mine.

BR,

-- 
J?r?me Pouiller, Sysmic
Embedded Linux specialist
http://www.sysmic.fr

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath
  2016-10-05  8:54     ` Jérôme Pouiller
@ 2016-10-16 10:58       ` Arnout Vandecappelle
  2016-10-16 11:43         ` Samuel Martin
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2016-10-16 10:58 UTC (permalink / raw)
  To: buildroot

 Hi Jerome,

On 05-10-16 10:54, J?r?me Pouiller wrote:
> Hi Arnout,
> 
> On Tuesday 04 October 2016 23:33:34 Arnout Vandecappelle wrote:
>> On 30-09-16 12:09, J?r?me Pouiller wrote:
>>> 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
>>
>>  Wouldn't this also be fixed by
>> http://patchwork.ozlabs.org/patch/613854/ ? With that patch (series)
>> applied, there shouldn't be any symlinks anymore once the real make
>> starts.
> 
> I didn't saw Samuel's patch. I will test it soon. I think it supersede 
> mine.

 You never came back to this. We will apply Samuel's patches soon. Can you
re-test after that and resubmit your patches if still needed?

 I've marked you patches as Rejected for now.

 Regards,
 Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath
  2016-10-16 10:58       ` Arnout Vandecappelle
@ 2016-10-16 11:43         ` Samuel Martin
  0 siblings, 0 replies; 8+ messages in thread
From: Samuel Martin @ 2016-10-16 11:43 UTC (permalink / raw)
  To: buildroot

Hi Jerome,

On Sun, Oct 16, 2016 at 12:58 PM, Arnout Vandecappelle <arnout@mind.be> wrote:
>  Hi Jerome,
>
> On 05-10-16 10:54, J?r?me Pouiller wrote:
>> Hi Arnout,
>>
>> On Tuesday 04 October 2016 23:33:34 Arnout Vandecappelle wrote:
>>> On 30-09-16 12:09, J?r?me Pouiller wrote:
>>>> 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
>>>
>>>  Wouldn't this also be fixed by
>>> http://patchwork.ozlabs.org/patch/613854/ ? With that patch (series)
>>> applied, there shouldn't be any symlinks anymore once the real make
>>> starts.
>>
>> I didn't saw Samuel's patch. I will test it soon. I think it supersede
>> mine.
>
>  You never came back to this. We will apply Samuel's patches soon. Can you
> re-test after that and resubmit your patches if still needed?

I've just reposted a new iteration of this change:
http://lists.busybox.net/pipermail/buildroot/2016-October/174677.html

Regards,

-- 
Samuel

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-16 11:43 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [Buildroot] [PATCH 1/2] check-host-rpath: support symlinks in rpath Jérôme Pouiller
2016-10-04 21:33   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.