Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2 v3] core/sdk: don't mangle symlinks with '.' or '..' at start
Date: Tue, 19 Feb 2019 08:29:12 +0100	[thread overview]
Message-ID: <877edwb5iv.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <b6f05f3a-d59a-7641-775e-ce06565ece73@mind.be> (Arnout Vandecappelle's message of "Wed, 6 Feb 2019 16:28:07 +0100")

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

Hi,

 > On 22/12/2018 16:18, Yann E. MORIN wrote:
 >> From: Joel Carlson <JoelsonCarl@gmail.com>
 >> 
 >> 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.
 >> 
 >> Signed-off-by: Joel Carlson <JoelsonCarl@gmail.com>
 >> [yann.morin.1998 at free.fr:
 >> - use a single transform pattern
 >> - use full HOST_DIR path as pattern to replace
 >> - update commit log accordingly
 >> ]
 >> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Committed to 2018.11.x, thanks.

-- 
Bye, Peter Korsgaard

      reply	other threads:[~2019-02-19  7:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-22 15:18 [Buildroot] [PATCH 0/2 v3] core/sdk: fix relative symlinks in generated tarball (branch yem/sdk) Yann E. MORIN
2018-12-22 15:18 ` [Buildroot] [PATCH 1/2 v3] core: make symlinks relative when preparing the SDK Yann E. MORIN
2018-12-26 21:21   ` Thomas Petazzoni
2019-01-05  0:53     ` Joel Carlson
2019-01-09 13:27       ` Andreas Naumann
2018-12-22 15:18 ` [Buildroot] [PATCH 2/2 v3] core/sdk: don't mangle symlinks with '.' or '..' at start Yann E. MORIN
2019-02-06 15:28   ` Arnout Vandecappelle
2019-02-19  7:29     ` Peter Korsgaard [this message]

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=877edwb5iv.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --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