From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support: properly check for bash as a dependency
Date: Mon, 17 Mar 2014 22:36:19 +0100 [thread overview]
Message-ID: <20140317213619.GB3393@free.fr> (raw)
In-Reply-To: <87k3bs5xc3.fsf@dell.be.48ers.dk>
Peter, All,
On 2014-03-17 22:28 +0100, Peter Korsgaard spake thusly:
> >>>>> "Yann" == Yann E MORIN <yann.morin.1998@free.fr> writes:
>
> > From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > The way we are checking for bash is to look if "$SHELL --version"
> > will return a string containing "^GNU bash".
>
> > In case the system shell is dash (eg. /bin/sh -> /bin/dash), but
> > the user's login shell is bash, dash will not override the SHELL
> > variable:
>
> > $ echo $SHELL
> > /bin/bash
> > $ /bin/dash
> > $$ echo $SHELL
> > /bin/bash
>
> > The same happens when called as the interpreter for a shell script:
>
> > $ cat foo.sh
> > #!/bin/dash
> > echo $SHELL
>
> > $ echo $SHELL
> > /bin/bash
> > $ ./foo.sh
> > /bin/bash
>
> > So, calling "$SHELL --version" will still return "^GNU bash" no matter
> > what shell is actually running.
>
> > Since quite a lot of #!/bin/sh scripts are in fact bash scripts, we
> > really want to ensure that /bin/sh is bash.
>
> Is that really still an issue? I just checked a few of the machines I
> often do buildroot builds on and they all have /bin/sh == dash.
Some configure-y scripts will run with /bin/sh, but have bashisms in them.
It was reported on IRC by Andrew that switching the system shell from
dash to bash fixed an issue (Andrew, was that with libxml2?).
> > -# Check bash
> > -if ! $SHELL --version 2>&1 | grep -q '^GNU bash'; then
> > +# Check bash is the system shell
> > +if ! /bin/sh --version 2>&1 | grep -q '^GNU bash'; then
>
> FYI, dash doesn't even understand a --version argument:
Yes, but it surely does not return something matching "^GNU bash" which
is all we care about.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2014-03-17 21:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 10:42 [Buildroot] [PATCH] support: properly check for bash as a dependency Yann E. MORIN
2014-03-17 21:28 ` Peter Korsgaard
2014-03-17 21:36 ` Yann E. MORIN [this message]
2014-03-17 22:01 ` Peter Korsgaard
2014-03-18 5:01 ` Thomas Petazzoni
2014-03-18 16:55 ` Yann E. MORIN
2014-03-18 18:27 ` Thomas Petazzoni
2014-03-20 20:43 ` Arnout Vandecappelle
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=20140317213619.GB3393@free.fr \
--to=yann.morin.1998@free.fr \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.