* [LTP] Shell usage on embedded targets @ 2010-10-27 11:24 David Peverley 2010-10-27 11:34 ` Garrett Cooper 0 siblings, 1 reply; 3+ messages in thread From: David Peverley @ 2010-10-27 11:24 UTC (permalink / raw) To: ltp-list Hi all, 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. This causes a pain as typically full systems use a symlink from sh to bash. This breaks runltp (and probably other scritps) as they use getopts which I *think* is technically a bash-only builtin? 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" ;-) Cheers, ~Pev ------------------------------------------------------------------------------ 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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] Shell usage on embedded targets 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 0 siblings, 1 reply; 3+ messages in thread From: Garrett Cooper @ 2010-10-27 11:34 UTC (permalink / raw) To: David Peverley; +Cc: ltp-list On Wed, Oct 27, 2010 at 4:24 AM, David Peverley <pev@sketchymonkey.com> wrote: > Hi all, > > 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. Who knows if they've been trying to import bugfixes or make it POSIX compliant either. > 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. > 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 . > 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. Thanks, -Garrett ------------------------------------------------------------------------------ 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 Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] Shell usage on embedded targets 2010-10-27 11:34 ` Garrett Cooper @ 2010-10-27 18:06 ` Mike Frysinger 0 siblings, 0 replies; 3+ messages in thread From: Mike Frysinger @ 2010-10-27 18:06 UTC (permalink / raw) To: ltp-list; +Cc: David Peverley [-- 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-10-27 18:08 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox