From patchwork Tue May 5 09:00:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Matz X-Patchwork-Id: 4622 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 1F377C70E; Tue, 5 May 2015 11:00:21 +0200 (CEST) Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by dpdk.org (Postfix) with ESMTP id 03921C6DE for ; Tue, 5 May 2015 11:00:20 +0200 (CEST) Received: by wiun10 with SMTP id n10so137655047wiu.1 for ; Tue, 05 May 2015 02:00:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2eNcvVroLiuRyOlPb17lFYEW0wWqmiXvDmxa4yW+eZs=; b=GLo7bYnHLir3IBfbiLg8rYbaeNBrRB7ic0OABeJ9wp6X8UzOMBbSgUGl9mARt80aVC tLvFvOwyVwR4sp954X1VFDLPxc/+00Oz/f8+YjzckX9+Gr2geZEwect0hU22hFUx7nzE SSLb8hYHmRNKWhlmeCtBiplWUGnGCrPEBGZ50Xn1pWJtCoXrDAQpHxfRrWN9ywsCV8r/ M0+oBFmxj9E6Jo0DPSmUq97h6aEww/bZenqdHzXV/JevhsqVvGU2qkQk3PhCML2SMcbe G1+xjhsn06TYlOMmvIXFHEeIQ0jKlCyP+9KvoDihYCQWIrbUwf5xVTjD/p30vlLSH3Di Bc8g== X-Gm-Message-State: ALoCoQnXRFgzdjcF7sFqL2usxWNLCThMfW2bTfiOtOvHMa+tJSg670MV1k4H16Iv4NM/GGGHTvoy X-Received: by 10.180.102.164 with SMTP id fp4mr2049858wib.67.1430816419647; Tue, 05 May 2015 02:00:19 -0700 (PDT) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id ex2sm24484659wjd.28.2015.05.05.02.00.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 May 2015 02:00:18 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Tue, 5 May 2015 11:00:09 +0200 Message-Id: <1430816409-6773-1-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <55476C37.8050702@netinsight.net> References: <55476C37.8050702@netinsight.net> Subject: [dpdk-dev] [PATCH] scripts: fix relpath.sh output when build dir is a symlink X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The script relpath.sh return the relative path of the first directory from the second directory. It is used to generate relative symlinks, which can be useful if the build directory is embedded in the dpdk directory: the whole dpdk can be moved without breaking the links, which is helpful for an installation. In case the build directory is a symlink, the script was not generating the proper relative path. Fix this by calling "readlink -f" on the arguments. Signed-off-by: Olivier Matz --- scripts/relpath.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/relpath.sh b/scripts/relpath.sh index 00030e5..7d2f48f 100755 --- a/scripts/relpath.sh +++ b/scripts/relpath.sh @@ -43,8 +43,13 @@ if [ $# -ne 2 ]; then exit 1 fi -REL1=${1#/} -REL2=${2#/} +# get the real absolute path, derefencing symlinks +ABS1=$(readlink -f $1) +ABS2=$(readlink -f $2) + +# remove leading slash +REL1=${ABS1#/} +REL2=${ABS2#/} left1=${REL1%%/*} right1=${REL1#*/}