From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::243; helo=mail-wm0-x243.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 88EBC21E082B5 for ; Wed, 14 Mar 2018 04:19:02 -0700 (PDT) Received: by mail-wm0-x243.google.com with SMTP id q83so3353286wme.5 for ; Wed, 14 Mar 2018 04:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=P7CvryycuLceJgrO8J1fbtA2gUOYC1CsolfosojRceg=; b=ga7ZhCc7+4ZjYw9vpTNpNeRPGZz8OzvqngQz09ruU4/+b+IYaX5yLRw69LXYcEtIvR bg8iBFQVzfAvM/0m8PwQAvCM82O5HR7rHW2XUGzTsLDx3ifHdCzJ554CoG9r7przUMgz +EsQaa0Mj8+YrKXaizioEddlRso/65RUjJowU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=P7CvryycuLceJgrO8J1fbtA2gUOYC1CsolfosojRceg=; b=RD5CMXgzPS4EfRjREDtV1sbQFt8dGJEsfklZ7Uukgl5XJi/+t4DyXuoezACUfadiGY 3glOtQRoPXXjLOK3ClJtJf16rpOgageyMnyE4SDQyqyc1YbKjjjWS4uVuUJhnELtgZGk DW/Qv64fodY2KarWS0YVWQWiGo7I8u0wiczaH3UKiG43UTTqpmateyO8mN0hbkFSCPXn Jplj9LHt6wITP5+tsbLhcgHUDR6Wz48VDGpNp+BtMqC5Doh47vq1bkofVUeCZVBmD2Wo 7o5J8h00SQkFLHuMzqUnFwbEsrZfLxCrHj8BCZQKYfAm/Ra8oUkGI/o/3R2nok2ACspj BpLw== X-Gm-Message-State: AElRT7ELzHXjMKMH95OUI63jic8sxEPXE/qnmHZS+HTnSLR+I7JIL1T5 ZG8ErIcqqP/a/fcdmAxDLd+G0Q== X-Google-Smtp-Source: AG47ELtkYcxz3W8CLuEkEpGPYjegAQpVthYQgjcRi2+6VvBvZ04dQ0kwC/KoPQa+mIvj4/6qf+Lovg== X-Received: by 10.28.4.216 with SMTP id 207mr1346080wme.108.1521026723608; Wed, 14 Mar 2018 04:25:23 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id c14sm1949381wmh.15.2018.03.14.04.25.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Mar 2018 04:25:22 -0700 (PDT) Date: Wed, 14 Mar 2018 11:25:21 +0000 From: Leif Lindholm To: Arvind Prasanna Cc: edk2-devel@lists.01.org Message-ID: <20180314112520.jzhk3aajfz3tyq6m@bivouac.eciton.net> References: <1520698318-9232-1-git-send-email-arvindprasanna@gmail.com> MIME-Version: 1.0 In-Reply-To: <1520698318-9232-1-git-send-email-arvindprasanna@gmail.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH] edksetup.sh: Update help section regarding positional X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Mar 2018 11:19:03 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Arvind, On Sat, Mar 10, 2018 at 11:11:58AM -0500, Arvind Prasanna wrote: > It is possible to source edksetup.sh from another script. If the > calling/sourcing script has any positional parameters set, those are > incorrectly accounted for in edksetup.sh while sourcing it resulting in > the the help section always being shown. This patch updates the help > section advising the user about these set positional parameters so they > can be unset prior to sourcing edksetup.sh. This is really just one of the unpleasantries of sourcing shell scripts. Since the current script could only ever work with bash anyway (and not sh, dash, ...) I don't know that we could do much better - and there's nothing about the problem that is specific to this script. As an aside, since we _know_ this only works on bash, you can also make use of the bash side effect that if you pass any arguments to the sourced script, it gets its own copies of $#, $0, $1 and so on. For ancient backwards compatility, the parameter BaseTools is ignored if provided on the command line. So you could always just use edksetup.sh BaseTools Alternatively, you can use edksetup.sh --reconfig which also ensures you are always using the latest toolchain templates. Regards, Leif > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Arvind Prasanna > --- > edksetup.sh | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/edksetup.sh b/edksetup.sh > index 93d6525..a3d5560 100755 > --- a/edksetup.sh > +++ b/edksetup.sh > @@ -42,6 +42,8 @@ function HelpMsg() > echo Please note: This script must be \'sourced\' so the environment can be changed. > echo ". $SCRIPTNAME" > echo "source $SCRIPTNAME" > + echo "If this script is being sourced from another script, please ensure that the" > + echo "sourcing/calling script has no set postional parameters." > } > > function SetWorkspace() > -- > 2.7.4 > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel