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: signature.asc
Description: This is a digitally signed message part.

------------------------------------------------------------------------------
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
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to