Skip to contentSkip to conversation

core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

PATCH New Yann E. MORIN 4 participants 13 messages Dec 7, 2018 – Dec 26, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

Hello All!

This two-patch series is my counter-proposal to Joel's path to try and fix the issue:

    https://patchwork.ozlabs.org/patch/1009168/

The first patch fixes the absolute symlinks, that were so far not accounted for at all. A new helper scripts changes them into relative symlinks.

The second patch is the actual fix to the issue Joel's patch was trying to solve. I believe it is a better and simpler solution, although I have to admit the patsubst trickery is not obvious.

Regards,
Yann E. MORIN.

The following changes since commit acb89c8d93952468fc9e24c7ddd9e361b8108e07

.gitlab-ci.yml: regenerate after prosody tests addition (2018-12-06 23:15:20 +0100)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 6ce3997e4824d41b50e13b8554e9f7e59e63a8af

core/sdk: don't mangle symlinks with '.' or '..' at start (2018-12-07 18:59:41 +0100)

----------------------------------------------------------------
Joel Carlson (1):
core/sdk: don't mangle symlinks with '.' or '..' at start

Yann E. MORIN (1):
core: make symlinks relative when preparing the SDK

 Makefile                     |  5 +++--
 support/scripts/fix-symlinks | 53 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100755 support/scripts/fix-symlinks
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#1 lore raw

PATCH 1/2 core: make symlinks relative when preparing the SDK

The SDK is supposed to be relocatable, so symlinks must not be absolute.

Add a new helper script, that replaces all absolute symlinks with relative ones.

The ideal solution would use the shortest relative path for the destination, but it is non-trivial to come up with. We just ensure the relative path does not cross a common base directory, and compute all the paths relative to that anchor.

This can give non-optimum relative symlinks, like:

    /base-dir/bin/foo -> ../bin/bar

when the optimum would have been:

    /base-dir/bin/foo -> bar

Finally, as a sanity check, ensure there is not relative symlinl pointing out of the base directory, because their targets would be missing from the SDK.

---
 Makefile                     |  1 +
 support/scripts/fix-symlinks | 53 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+)
 create mode 100755 support/scripts/fix-symlinks
Makefile +1 -0
index 37df98520e..e8a1c7b366 100644
@@ -586,6 +586,7 @@ prepare-sdk: world
 	@$(call MESSAGE,"Rendering the SDK relocatable")
 	$(TOPDIR)/support/scripts/fix-rpath host
 	$(TOPDIR)/support/scripts/fix-rpath staging
+	$(TOPDIR)/support/scripts/fix-symlinks "$(HOST_DIR)"
 	$(INSTALL) -m 755 $(TOPDIR)/support/misc/relocate-sdk.sh $(HOST_DIR)/relocate-sdk.sh
 	mkdir -p $(HOST_DIR)/share/buildroot
 	echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location
support/scripts/fix-symlinks new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH 1/2 core: make symlinks relative when preparing the SDK

Quoted 16 lines · Yann E. MORIN

The SDK is supposed to be relocatable, so symlinks must not be absolute.

Add a new helper script, that replaces all absolute symlinks with relative ones.

The ideal solution would use the shortest relative path for the destination, but it is non-trivial to come up with. We just ensure the relative path does not cross a common base directory, and compute all the paths relative to that anchor.

This can give non-optimum relative symlinks, like:

    /base-dir/bin/foo -> ../bin/bar

when the optimum would have been:

Quoted 8 lines
    /base-dir/bin/foo -> bar

Finally, as a sanity check, ensure there is not relative symlinl pointing out of the base directory, because their targets would be missing from the SDK.

Applied this patch and patch 2/2 to my branch and made sure the SDK generated and the symlinks I had seen fail before looked to be correct.
I also added a few of my own symlinks into host/ with absolute paths pointing both inside and outside of host/ to test that the cases caught them.
And I added some relative symlinks that crossed the boundary to make sure that case was caught as well.

#3 lore raw

PATCH 2/2 core/sdk: don't mangle symlinks with '.' or '..' at start

In reply to Yann E. MORIN

From: Joel Carlson <[email protected]>

The current transform changes any '.' at the start of a filename to $(BR2_SDK_PREFIX). This also applies to the target of a symlink, when it is relative.

We thus might end up with something like:

    $(BR2_SDK_PREFIX)/bin/aarch64-linux-gnu-ar ->
    $(BR2_SDK_PREFIX)./opt/ext-toolchain/bin/aarch64-linux-gnu-ar

when it should be:

    $(BR2_SDK_PREFIX)/bin/aarch64-linux-gnu-ar ->
    ../opt/ext-toolchain/bin/aarch64-linux-gnu-ar

We fix that by making sure we always remove a known prefix, i.e. we remove the path to host dir. The obvious solution would be to cd into $(HOST_DIR)/.. , then tar ./host/ and finally use a --transfrom pattern as 's,^\./$(notdir $(HOST_DIR)),$(BR2_SDK_PREFIX)'.

Since $(HOST_DIR) can point to a user-supplied location, we don't know very well how the pattern may patch.

Instead, we cd into / and tar the full path to $(HOST_DIR).

Since tar removes any leading '/', it would spurr a warning message, which is annoying. So we explicitly remove the leading '/' from $(HOST_DIR) when we tar it.

Finally, we transform all filenames to replace a leading $(HOST_DIR) (without a leading /) to the prefix to use.

[yann.morin.1998 at free.fr:
- use a single transform pattern
- use full HOST_DIR path as pattern to replace
- update commit log accordingly
]

---
Changes v1 -> v2: (Yann)
- changes in the commit log, above.

---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Makefile +2 -2
index e8a1c7b366..1a2783c477 100644
@@ -599,8 +599,8 @@ sdk: prepare-sdk $(BR2_TAR_HOST_DEPENDENCY)
 	$(Q)mkdir -p $(BINARIES_DIR)
 	$(TAR) czf "$(BINARIES_DIR)/$(BR2_SDK_PREFIX).tar.gz" \
 		--owner=0 --group=0 --numeric-owner \
-		--transform='s#^\.#$(BR2_SDK_PREFIX)#' \
-		-C $(HOST_DIR) "."
+		--transform='s#^$(patsubst /%,%,$(HOST_DIR))#$(BR2_SDK_PREFIX)#' \
+		-C / $(patsubst /%,%,$(HOST_DIR))
 
 RSYNC_VCS_EXCLUSIONS = \
 	--exclude .svn --exclude .git --exclude .hg --exclude .bzr \
Signature · 1 line
2.14.1
Applied
#4 lore raw

PATCH 2/2 core/sdk: don't mangle symlinks with '.' or '..' at start

Quoted 32 lines · Yann E. MORIN

From: Joel Carlson <[email protected]>

The current transform changes any '.' at the start of a filename to $(BR2_SDK_PREFIX). This also applies to the target of a symlink, when it is relative.

We thus might end up with something like:

    $(BR2_SDK_PREFIX)/bin/aarch64-linux-gnu-ar ->
    $(BR2_SDK_PREFIX)./opt/ext-toolchain/bin/aarch64-linux-gnu-ar

when it should be:

    $(BR2_SDK_PREFIX)/bin/aarch64-linux-gnu-ar ->
    ../opt/ext-toolchain/bin/aarch64-linux-gnu-ar

We fix that by making sure we always remove a known prefix, i.e. we remove the path to host dir. The obvious solution would be to cd into $(HOST_DIR)/.. , then tar ./host/ and finally use a --transfrom pattern as 's,^\./$(notdir $(HOST_DIR)),$(BR2_SDK_PREFIX)'.

Since $(HOST_DIR) can point to a user-supplied location, we don't know very well how the pattern may patch.

Instead, we cd into / and tar the full path to $(HOST_DIR).

Since tar removes any leading '/', it would spurr a warning message, which is annoying. So we explicitly remove the leading '/' from $(HOST_DIR) when we tar it.

Finally, we transform all filenames to replace a leading $(HOST_DIR) (without a leading /) to the prefix to use.

Quoted 8 lines

[yann.morin.1998 at free.fr:
- use a single transform pattern
- use full HOST_DIR path as pattern to replace
- update commit log accordingly
]

So not sure what protocol is on tags when this is essentially v2 of my own patch, but...

Applied this and the first patch to my branch and made sure my SDKs seemed to have the correct links.

#5 lore raw

PATCH 2/2 core/sdk: don't mangle symlinks with '.' or '..' at start

Joel, All,

On 2018-12-07 12:39 -0700, Joel Carlson spake thusly:

Quoted 40 lines · Yann E. MORIN
Quoted 30 lines

From: Joel Carlson <[email protected]>
The current transform changes any '.' at the start of a filename to $(BR2_SDK_PREFIX). This also applies to the target of a symlink, when it is relative.

We thus might end up with something like:

    $(BR2_SDK_PREFIX)/bin/aarch64-linux-gnu-ar ->
    $(BR2_SDK_PREFIX)./opt/ext-toolchain/bin/aarch64-linux-gnu-ar

when it should be:

    $(BR2_SDK_PREFIX)/bin/aarch64-linux-gnu-ar ->
    ../opt/ext-toolchain/bin/aarch64-linux-gnu-ar

We fix that by making sure we always remove a known prefix, i.e. we remove the path to host dir. The obvious solution would be to cd into $(HOST_DIR)/.. , then tar ./host/ and finally use a --transfrom pattern as 's,^\./$(notdir $(HOST_DIR)),$(BR2_SDK_PREFIX)'.

Since $(HOST_DIR) can point to a user-supplied location, we don't know very well how the pattern may patch.

Instead, we cd into / and tar the full path to $(HOST_DIR).

Since tar removes any leading '/', it would spurr a warning message, which is annoying. So we explicitly remove the leading '/' from $(HOST_DIR) when we tar it.

Finally, we transform all filenames to replace a leading $(HOST_DIR) (without a leading /) to the prefix to use.

Quoted 8 lines

[yann.morin.1998 at free.fr:
- use a single transform pattern
- use full HOST_DIR path as pattern to replace
- update commit log accordingly
]

Quoted 4 lines

So not sure what protocol is on tags when this is essentially v2 of my own patch, but...

Since my proposal is more than trivial tweaks of your proposal, your tags are welcome.

Thanks for reporting the issue, for your initial patch which got me kickstarted, and thanks for your review and tests! :-)

Regards,
Yann E. MORIN.

Quoted 2 lines

Applied this and the first patch to my branch and made sure my SDKs seemed to have the correct links.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

In reply to Yann E. MORIN

Hello Yann, Joel,

Am 07.12.18 um 19:10 schrieb Yann E. MORIN:

Quoted 6 lines

Hello All!

This two-patch series is my counter-proposal to Joel's path to try and fix the issue:

     https://patchwork.ozlabs.org/patch/1009168/
Quoted 7 lines

The first patch fixes the absolute symlinks, that were so far not accounted for at all. A new helper scripts changes them into relative symlinks.

The second patch is the actual fix to the issue Joel's patch was trying to solve. I believe it is a better and simpler solution, although I have to admit the patsubst trickery is not obvious.

Thank you for these patches as they adress an SDK issue I have just found. I have applied them on top of 2018.11 and verified the link ./usr -> ./ remains as is and is not changed into a dead link to ./arm-buildroot-linux-gnueabihf_sdk-buildroot/.

However, the check for symlinks pointing out of host/ showed to two issues originating in install steps of iptables and eudev. Both create links that point to system pathes.

I have locally made POST_STAGING_HOOKS to fix that but that's probably a non acceptable hack.

Regards,
Andreas

Quoted 32 lines

Regards,
Yann E. MORIN.

The following changes since commit acb89c8d93952468fc9e24c7ddd9e361b8108e07

   .gitlab-ci.yml: regenerate after prosody tests addition (2018-12-06 23:15:20 +0100)

are available in the git repository at:

git://git.buildroot.org/~ymorin/git/buildroot.git

for you to fetch changes up to 6ce3997e4824d41b50e13b8554e9f7e59e63a8af

   core/sdk: don't mangle symlinks with '.' or '..' at start (2018-12-07 18:59:41 +0100)

----------------------------------------------------------------
Joel Carlson (1):
core/sdk: don't mangle symlinks with '.' or '..' at start

Yann E. MORIN (1):
core: make symlinks relative when preparing the SDK

  Makefile                     |  5 +++--
  support/scripts/fix-symlinks | 53 ++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 56 insertions(+), 2 deletions(-)

create mode 100755 support/scripts/fix-symlinks

#7 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

Andreas,

On Fri, Dec 21, 2018 at 2:46 AM Andreas Naumann <[email protected]> wrote:

<snip>

Quoted 6 lines

However, the check for symlinks pointing out of host/ showed to two issues originating in install steps of iptables and eudev. Both create links that point to system pathes.

I have locally made POST_STAGING_HOOKS to fix that but that's probably a non acceptable hack.

Would be hard to tell without seeing the actual change. ;-) That being said, this is probably something that would need to be fixed in iptables and eudev (patches submitted upstream), and then those patches added to buildroot to fix the issue.

So far I've submitted a patch to iptables here:
http://patchwork.ozlabs.org/patch/1017739/

And a patch to buildroot to pull in a version of that here:
https://patchwork.ozlabs.org/patch/1017740/

I've also submitted a pull request for eudev (and while typing this email it was already merged):
https://github.com/gentoo/eudev/pull/165

I'll submit a patch for eudev in buildroot to pull in that change once I see feedback on the iptables one. For it to work for me I needed to set AUTORECONF=YES on eudev, but I don't really understand autotools/automake stuff very well and I don't know if that is the right way to be doing things.
-Joel

#8 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

Joel, Andreas, All,

On 2018-12-21 17:13 -0700, Joel Carlson spake thusly:

Quoted 16 lines · Andreas Naumann
Quoted 6 lines

However, the check for symlinks pointing out of host/ showed to two issues originating in install steps of iptables and eudev. Both create links that point to system pathes.

I have locally made POST_STAGING_HOOKS to fix that but that's probably a non acceptable hack.

Would be hard to tell without seeing the actual change. ;-) That being said, this is probably something that would need to be fixed in iptables and eudev (patches submitted upstream), and then those patches added to buildroot to fix the issue.

So far I've submitted a patch to iptables here:
http://patchwork.ozlabs.org/patch/1017739/

Quoted 6 lines

And a patch to buildroot to pull in a version of that here:
https://patchwork.ozlabs.org/patch/1017740/

I've also submitted a pull request for eudev (and while typing this email it was already merged):
https://github.com/gentoo/eudev/pull/165

I did nt see Thomas' reply to the iptables patch before I replied to your eudev one. It turns out we basically said exactly the same thing:
this is not the correct solution.

If you do what you propose, then you can see that at runtime, on the _target_, the symlinks will be wrong, bnecause they would be prefixed with the DESTDIR, which is clearly not appropriate.

A better solution, in that case, wuld be to make relative symlinks instead, but that is a little bit trickier. A simple way to do that is to use 'ln -r -s FILE LINK' but the -r option is not old enough to be widely available on all distors, especially entreprise-grade distros.

An other approach, would be that we whietelist certain PATHs from our SDK. Afterall, there are things we do not care about in the SDK. For example, most executables in staging/{,usr/}{,s}bin are not needed. We only really need libs and headers, so we could just ignore anything that is not in staging/{lib,usr/lib,usr/include}/

I.e. the heuristic would become:

if it is a symlink:
if is not below staging/:
check and fix it
else if it is below staging/{lib,usr/lib,usr/include}:
check and fix it
else
ignore it

I can try to look into fixing that in my series. Is enabling eudev and/or iptables enough to echibit the problem?

Regards,
Yann E. MORIN.

Quoted 6 lines

I'll submit a patch for eudev in buildroot to pull in that change once I see feedback on the iptables one. For it to work for me I needed to set AUTORECONF=YES on eudev, but I don't really understand autotools/automake stuff very well and I don't know if that is the right way to be doing things.
-Joel

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

Quoted 23 lines · Yann E. MORIN

Joel, Andreas, All,

On 2018-12-21 17:13 -0700, Joel Carlson spake thusly:

Quoted 19 lines · Andreas Naumann
Quoted 6 lines

However, the check for symlinks pointing out of host/ showed to two issues originating in install steps of iptables and eudev. Both create links that point to system pathes.

I have locally made POST_STAGING_HOOKS to fix that but that's probably a non acceptable hack.

Would be hard to tell without seeing the actual change. ;-) That being said, this is probably something that would need to be fixed in iptables and eudev (patches submitted upstream), and then those patches added to buildroot to fix the issue.

So far I've submitted a patch to iptables here:
http://patchwork.ozlabs.org/patch/1017739/

And a patch to buildroot to pull in a version of that here:
https://patchwork.ozlabs.org/patch/1017740/

Quoted 7 lines
Quoted 3 lines

I've also submitted a pull request for eudev (and while typing this email it was already merged):
https://github.com/gentoo/eudev/pull/165

I did nt see Thomas' reply to the iptables patch before I replied to your eudev one. It turns out we basically said exactly the same thing:
this is not the correct solution.

My apologies on submitting a bad patch.

Quoted 25 lines

If you do what you propose, then you can see that at runtime, on the _target_, the symlinks will be wrong, bnecause they would be prefixed with the DESTDIR, which is clearly not appropriate.

A better solution, in that case, wuld be to make relative symlinks instead, but that is a little bit trickier. A simple way to do that is to use 'ln -r -s FILE LINK' but the -r option is not old enough to be widely available on all distors, especially entreprise-grade distros.

An other approach, would be that we whietelist certain PATHs from our SDK. Afterall, there are things we do not care about in the SDK. For example, most executables in staging/{,usr/}{,s}bin are not needed. We only really need libs and headers, so we could just ignore anything that is not in staging/{lib,usr/lib,usr/include}/

I.e. the heuristic would become:

if it is a symlink:
if is not below staging/:
check and fix it
else if it is below staging/{lib,usr/lib,usr/include}:
check and fix it
else
ignore it

Quoted 2 lines

I can try to look into fixing that in my series. Is enabling eudev and/or iptables enough to echibit the problem?

That is a better solution. And yes, with the previous sdk fixes applied, just enabling eudev and/or iptables and then trying to 'make sdk' would error out because of the symlink path being outside of staging.

Quoted 17 lines

Regards,
Yann E. MORIN.

Quoted 6 lines

I'll submit a patch for eudev in buildroot to pull in that change once I see feedback on the iptables one. For it to work for me I needed to set AUTORECONF=YES on eudev, but I don't really understand autotools/automake stuff very well and I don't know if that is the right way to be doing things.
-Joel

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

#10 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

Joel, All,

On 2018-12-22 11:21 -0700, Joel Carlson spake thusly:

Quoted 1 line · Yann E. MORIN

[--SNIP--]

Quoted 4 lines
Quoted 3 lines

I did nt see Thomas' reply to the iptables patch before I replied to your eudev one. It turns out we basically said exactly the same thing:
this is not the correct solution.

My apologies on submitting a bad patch.

Hey, no worries! :-) That's what reviews are for.

Quoted 8 lines
Quoted 8 lines

if it is a symlink:
if is not below staging/:
check and fix it
else if it is below staging/{lib,usr/lib,usr/include}:
check and fix it
else
ignore it

Quoted 7 lines
Quoted 2 lines

I can try to look into fixing that in my series. Is enabling eudev and/or iptables enough to echibit the problem?

That is a better solution. And yes, with the previous sdk fixes applied, just enabling eudev and/or iptables and then trying to 'make sdk' would error out because of the symlink path being outside of staging.

Yeah, I eventually managed to reproduce the issue, indeed. so I submitted v3 of the series. Thanks! :-)

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#11 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

In reply to Joel Carlson
Quoted 8 lines · Joel Carlson
Quoted 7 lines · Yann E. MORIN

An other approach, would be that we whietelist certain PATHs from our SDK. Afterall, there are things we do not care about in the SDK. For example, most executables in staging/{,usr/}{,s}bin are not needed. We only really need libs and headers, so we could just ignore anything that is not in staging/{lib,usr/lib,usr/include}/

With per-package staging, could this be done before the per-package staging areas are combined? The idea would be to reduce differences between the stage in buildroot and the stage when using an SDK. Every difference is a possible source of problems, even if it is something that we are not supposed to care about.

Could this be taken further, and everything not in the stage whitelist be deleted? It would be nice if the SDK were smaller.

#12 lore raw

cover core/sdk: fix relative symlinks in generated tarball (branch yem/sdk)

In reply to Andreas Naumann

Andreas, All,

On 2018-12-21 10:46 +0100, Andreas Naumann spake thusly:

Quoted 13 lines

Am 07.12.18 um 19:10 schrieb Yann E. MORIN:

Quoted 11 lines

This two-patch series is my counter-proposal to Joel's path to try and fix the issue:

    https://patchwork.ozlabs.org/patch/1009168/

The first patch fixes the absolute symlinks, that were so far not accounted for at all. A new helper scripts changes them into relative symlinks.

The second patch is the actual fix to the issue Joel's patch was trying to solve. I believe it is a better and simpler solution, although I have to admit the patsubst trickery is not obvious.

Quoted 8 lines

Thank you for these patches as they adress an SDK issue I have just found. I have applied them on top of 2018.11 and verified the link ./usr -> ./ remains as is and is not changed into a dead link to ./arm-buildroot-linux-gnueabihf_sdk-buildroot/.

However, the check for symlinks pointing out of host/ showed to two issues originating in install steps of iptables and eudev. Both create links that point to system pathes.

Ok, thanks for the report! :-)

Quoted 2 lines

I have locally made POST_STAGING_HOOKS to fix that but that's probably a non acceptable hack.

Indeed no, please see my reply to Joel's suggestion instead.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'