From: Mike Frysinger <vapier@gentoo.org>
To: ltp-list@lists.sourceforge.net
Cc: David Peverley <pev@sketchymonkey.com>
Subject: Re: [LTP] Shell usage on embedded targets
Date: Wed, 27 Oct 2010 14:06:51 -0400 [thread overview]
Message-ID: <201010271406.52236.vapier@gentoo.org> (raw)
In-Reply-To: <AANLkTimC09CBkscKJvpFTRhs2GuXc0MwiV9GLLVZEb5p@mail.gmail.com>
[-- Attachment #1.1: Type: Text/Plain, Size: 2847 bytes --]
On Wednesday, October 27, 2010 07:34:14 Garrett Cooper wrote:
> On Wed, Oct 27, 2010 at 4:24 AM, David Peverley wrote:
> > In our embedded rootfs we have both /bin/sh provided by busybox (i.e.
> > a true sh) and also a /bin/bash compiled from bash.
>
> busybox sh is based off ash (which forked off BSD's /bin/sh,
> IIRC), but it looks like they stripped away a lot of effective
> features in /bin/sh, in an effort to try and trim down the size of the
> rootfs. Pity, because it cripples the shell interpreter.
not really true. busybox may be either ash or hush. the latter is the only
option for NOMMU systems (like my Blackfin board). no way in hell something
like bash is going to work on a NOMMU system.
> Who knows if they've been trying to import bugfixes or make it
> POSIX compliant either.
i think it's diverged too far for most bugfixes to be useful. but both shells
absolutely strive for POSIX compliance. if something is in POSIX but doesnt
work with the busybox shells, then a bug should be filed so it can be fixed.
> > This causes a pain as typically full systems use a symlink from sh to
> > bash.
>
> Actually it's hardlinked in proper configurations that I've run
> into. Symlinking allows for naughtiness.
most i see use symlinks. i dont think there's any realistic differences
between the two.
> > This breaks runltp (and probably other scritps) as they use
> > getopts which I *think* is technically a bash-only builtin?
>
> Wrong. It's a POSIX shell built-in:
> http://www.opengroup.org/onlinepubs/009695399/utilities/getopts.html .
it isnt required to be a shell built in, but generally it is ... busybox's ash
implementation does it this way
> > I've currently re-written the hashbangs before copying to the system. For
> > those googling I did :
> > find . -type f | xargs perl -pi -e 's/bin\/sh/bin\/bash/g'
> >
> > I can't get my head around what a 'neat' solution would be other than
> > rewriting all to bash but I'm guessing that isn't a favoured choice
> > for most people? I would expect a fair response would be "don't do odd
> > things with your target" ;-)
>
> Or maybe you should just hardlink /bin/bash to /bin/sh like most
> Linux targets (or spoof a non-Busybox based environment with a
> chrooted env with /bin/bash setup as /bin/sh)? This isn't ideal, but
> unless you have access to a /bin/sh that's can do POSIX compliant
> shell constructs you're kind of SoL with LTP.
if the person who configured their busybox shell didnt enable getopts support,
they screwed up and this is their problem. if the busybox getopts isnt
conforming to the POSIX spec, then the person hitting the problem should (1)
make sure they're using the latest busybox release and (2) file a bug at
bugs.busybox.net.
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 415 bytes --]
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
prev parent reply other threads:[~2010-10-27 18:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 11:24 [LTP] Shell usage on embedded targets David Peverley
2010-10-27 11:34 ` Garrett Cooper
2010-10-27 18:06 ` Mike Frysinger [this message]
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=201010271406.52236.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=ltp-list@lists.sourceforge.net \
--cc=pev@sketchymonkey.com \
/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