Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <jacmet@uclibc.org>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support: properly check for bash as a dependency
Date: Mon, 17 Mar 2014 22:28:28 +0100	[thread overview]
Message-ID: <87k3bs5xc3.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1395052954-1567-1-git-send-email-yann.morin.1998@free.fr> (Yann E. MORIN's message of "Mon, 17 Mar 2014 11:42:34 +0100")

>>>>> "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.


 > -# 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:

sh --version
sh: 0: Illegal option --

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2014-03-17 21:28 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 [this message]
2014-03-17 21:36   ` Yann E. MORIN
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=87k3bs5xc3.fsf@dell.be.48ers.dk \
    --to=jacmet@uclibc.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox