From: Arvind Prasanna <arvindprasanna@gmail.com>
To: Leif Lindholm <leif.lindholm@linaro.org>
Cc: edk2-devel@lists.01.org
Subject: Re: [PATCH] edksetup.sh: Update help section regarding positional
Date: Fri, 16 Mar 2018 02:18:29 -0400 [thread overview]
Message-ID: <CAK-=9LrQ3gGRM7LAmOzKcOkrjJb84ZPt0SgCJryBTTpSew8SHA@mail.gmail.com> (raw)
In-Reply-To: <20180314112520.jzhk3aajfz3tyq6m@bivouac.eciton.net>
Hi Leif:
Thank you for your feedback. I concur with you that it is a bash side
effect, desired or undesired :) . I ran into this issue with positional
parameters and thought a small message would be helpful to users. I will no
longer pursue this issue.
Thanks,
Arvind.
On Wed, Mar 14, 2018 at 7:25 AM, Leif Lindholm <leif.lindholm@linaro.org>
wrote:
> 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 <arvindprasanna@gmail.com>
> > ---
> > 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
>
next prev parent reply other threads:[~2018-03-16 6:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-10 16:11 [PATCH] edksetup.sh: Update help section regarding positional Arvind Prasanna
2018-03-14 11:25 ` Leif Lindholm
2018-03-16 6:18 ` Arvind Prasanna [this message]
[not found] <1520669933-8602-1-git-send-email-arvindprasanna@gmail.com>
[not found] ` <CAK-=9LqFN3c_ZOnFO=fAnnk6wqKxmbF+LXhek2x6tkXNB37e-g@mail.gmail.com>
2018-03-12 14:55 ` Gao, Liming
2018-03-12 17:17 ` Arvind Prasanna
2018-03-13 5:41 ` Arvind Prasanna
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-list 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='CAK-=9LrQ3gGRM7LAmOzKcOkrjJb84ZPt0SgCJryBTTpSew8SHA@mail.gmail.com' \
--to=devel@edk2.groups.io \
/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