From patchwork Fri Dec 7 03:50:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Carlson X-Patchwork-Id: 1009168 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="otKsp9X+"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 439z6g6hH6z9s1c for ; Fri, 7 Dec 2018 14:51:38 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id AD430871E0; Fri, 7 Dec 2018 03:51:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wci97PqqO-YM; Fri, 7 Dec 2018 03:51:31 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 4FA2487055; Fri, 7 Dec 2018 03:51:31 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 4B94E1C0B15 for ; Fri, 7 Dec 2018 03:51:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5D37D87CA0 for ; Fri, 7 Dec 2018 03:51:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aRtD1Ce7kMCu for ; Fri, 7 Dec 2018 03:51:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-it1-f195.google.com (mail-it1-f195.google.com [209.85.166.195]) by hemlock.osuosl.org (Postfix) with ESMTPS id C28FC87B5E for ; Fri, 7 Dec 2018 03:51:21 +0000 (UTC) Received: by mail-it1-f195.google.com with SMTP id x124so537080itd.1 for ; Thu, 06 Dec 2018 19:51:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=H2tV3L7yin57r9TkiP0Jx5fhTaqQ+8NHXxP/YrdY8NQ=; b=otKsp9X+uP3eefyWC9xCAvJPwfsC6CdO3/xVVzA3LMCxyw9+UWoWvSJ+F/Ynk8aR/X 9LtE6v5KIJ9GDSxmj8Fd7+Q9NlvrGIXIQXr9NcOfOSNX1xM1MGXNNWjKoRvhiT6oDnJi WVL3mr/eBYvStI/Te81e/u4qqWfE6iSgCHYUXRa4p+gWAtC1bBsf56EZUKiZlH3FmAm3 Hs3iEhu2I6yiDRAfinN5MS/PoL9jkOuEsIot5Iwbi4K/qZXDxm1YuyLIRfW/F2olvsjS FPUZhmkmmwhng53zonq4eRx3qJajFhbrmtF28NO8pWCgZKWoycdwbFjvFJWJ4eg0Uywy /9BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=H2tV3L7yin57r9TkiP0Jx5fhTaqQ+8NHXxP/YrdY8NQ=; b=CfJcd63Gawl61BOhAQuRglJKmkD9017wYC9PAnXt60NTRKgiyJDlNsCpSDEfuFlKwZ e5z1gxAVs6fq5htUzgTNRssFnIhi0OelY4h5ZTJRoLLYZMZZshPKxwyQ2HXOwcGEmNC0 UGkRgREfVfL0itW2SYIqjad7lVManEX3MTbu1apU++ZaSov1JbTmAlv9W80fKoDUw0bO EgYnJHIBeGP2l1JCdOMRQq+8HzeGwiewKqZFjtEcbRUIze0tr/RzsTvzFzfyq09AORol AcP0C0qwAnuYjMgDasSSuTuvJ7LFB0hM0EAAeB6/64WfH8AKqI8wQ4CRCyPB3sg6FWUJ 5WPA== X-Gm-Message-State: AA+aEWYWrdXgQfaULhfKLtzuCyIi4yfbaWKzoWZqZ5QbW1s1szpr7scM GlPcbqN2BcHHdFCi4mmm0O71TRL/ X-Google-Smtp-Source: AFSGD/XXJp9n9YoNFWmB8ebQ8EyxobFrsXIqTmVcwovZqo1WigAXZjFZwaDPa1wSVrloaFkp6x2Wvw== X-Received: by 2002:a24:6890:: with SMTP id v138mr903217itb.53.1544154680946; Thu, 06 Dec 2018 19:51:20 -0800 (PST) Received: from caes-s76-9.eng.cosmicaes.com (50-206-27-134-static.hfc.comcastbusiness.net. [50.206.27.134]) by smtp.gmail.com with ESMTPSA id e2sm55430iok.34.2018.12.06.19.51.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 19:51:20 -0800 (PST) From: Joel Carlson X-Google-Original-From: Joel Carlson To: buildroot@buildroot.org Date: Thu, 6 Dec 2018 20:50:52 -0700 Message-Id: <20181207035052.316-1-JoelsonCarl@gmail.com> X-Mailer: git-send-email 2.17.1 Subject: [Buildroot] [PATCH 1/1] core/sdk: don't mangle symlinks with '.' or '..' at start X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E . MORIN" , Wolfgang Grandegger MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The previous transform of changing any '.' at the start of a line to $(BR2_SDK_PREFIX) mangles any symlinks with a relative path starting with '.' or '..' in the host folder, as --transform operates on the link target as opposed to the link name. You 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 Instead, don't change to HOST_DIR when creating the tarball, and pass the path to HOST_DIR. Tar will strip the leading / from member names, so then transform that path (HOST_DIR with leading / removed) to BR2_SDK_PREFIX. However hardlinks are still linking to HOST_DIR, so do an additional transform of $(HOST_DIR) (keeping the leading slash) to BR2_SDK_PREFIX in order to catch those. Signed-off-by: Joel Carlson --- If accepted, this should probably get put on 2018.11.x. --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 37df98520e..668c3e09e0 100644 --- a/Makefile +++ b/Makefile @@ -591,6 +591,7 @@ prepare-sdk: world echo $(HOST_DIR) > $(HOST_DIR)/share/buildroot/sdk-location BR2_SDK_PREFIX ?= $(GNU_TARGET_NAME)_sdk-buildroot +HOST_DIR_NO_LEAD_SLASH=$(shell echo $(HOST_DIR) | tail -c +2) .PHONY: sdk sdk: prepare-sdk $(BR2_TAR_HOST_DEPENDENCY) @$(call MESSAGE,"Generating SDK tarball") @@ -598,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#^$(HOST_DIR_NO_LEAD_SLASH)#$(BR2_SDK_PREFIX)#' \ + --transform='s#^$(HOST_DIR)#$(BR2_SDK_PREFIX)#' $(HOST_DIR) RSYNC_VCS_EXCLUSIONS = \ --exclude .svn --exclude .git --exclude .hg --exclude .bzr \