[oe] [PATCH] bash: add alternative configuration for bin/sh -> /bin/bash

Chris Larson clarson at kergoth.com
Wed Apr 1 17:12:51 UTC 2009


On Wed, Apr 1, 2009 at 10:01 AM, Koen Kooi <k.kooi at student.utwente.nl> wrote:
> On 01-04-09 18:52, Chris Larson wrote:
>>
>> On Wed, Apr 1, 2009 at 9:26 AM, Tim Harvey<tharvey at irobot.com>  wrote:
>>>
>>> Chris Larson wrote:
>>>>
>>>> Be very careful with this.  Specifically, be sure to thoroughly test
>>>> installing bash onto a system that currently has busybox, and the
>>>> upgrade paths for both busybox and bash.  You never want to get into a
>>>> state, due to pre/post rm/install script execution order, where
>>>> /bin/sh doesn't exist.  If that happens, you won't be able to execute
>>>> the next script to fix it :)
>>>>
>>>
>>> in my case, I have both bash and busybox installed and I want bash to
>>> take
>>> priority as the /bin/sh which it otherwise does not.
>>>
>>> attempting to remove the package that contains your shell is something
>>> you
>>> need to be careful as anyway.
>>>
>>> This seems to me to be a prime example of where alternatives should be
>>> used?
>>
>> You missed my point, it seems.  I was talking about
>> update-alternatives.  Depending on how update-alternatives is
>> implemented, there could be issues similar to what I mentioned in the
>> previous email.  Consider: if it uses system(), which calls /bin/sh,
>> to remove the old /bin/sh link, and then calls system() again to
>> create the new, it will fail.  Speculation, but again, it's something
>> you always need to keep in mind if you're messing with /bin/sh in any
>> way.
>
> IIRC our default u-a is a shell script, the other version is a perl script.
> Correct me if I'm wrong, it has been some years since I looked at it :)

That reminds me, one of my coworkers pointed me to a C implementation.
 If you grab the chkconfig srpm from centos 5.2, or another redhat
based distribution, you'll find an alternatives.c written by redhat,
whose syntax is the same as debian update-alternatives.  Might be
worth looking at.
-- 
Chris Larson
clarson at kergoth dot com
clarson at mvista dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Software Engineer
MontaVista Software, Inc.




More information about the Openembedded-devel mailing list