[uClibc]RE: [uClinux-dev] RE: [BusyBox] Re: BusyBox `msh' doesn't work co rrectly with vfork / uClibc

JINGSONG LIU JLiu at PacesetterElectronics.com
Tue Mar 5 20:26:29 UTC 2002


Thank you very much !

I'm new to Linux and uclinux would you please give me some more information
about
how to set up uclinux under the readhat 7.2 ?

Thank you in advance

JSL

-----Original Message-----
From: Stefan Soucek [mailto:ssoucek at coactive.com]
Sent: Tuesday, March 05, 2002 12:18 PM
To: 'Miles Bader'; andersen at codepoet.org
Cc: uclibc at uclibc.org; uclinux-dev at uclinux.org; busybox at busybox.net
Subject: [uClinux-dev] RE: [BusyBox] Re: BusyBox `msh' doesn't work
correctly with vfork / uClibc


Thanks for looking through. This has been sleeping for a while and
I might put some work into it to synch up our msh version.

> I looked at that patch, and found that most of it had already been
> applied in the version of busybox/msh.c that I have (which is from
> uClinux-dist-20020220, and claims to be version 0.60.0).  Those parts
> seems sane.
> 
> However, Stefan's patch doesn't address the problem with `exit' that I
> reported, so my patch (that changes things to use `_exit') or 
> something
> similar is still necessary.

I obviously missed those parts. I don't know why our shell doesn't crash
on them but maybe they never get activated.

> The parts of Stefan's patch which _aren't_ in the current sources are:
> 
>   (1) Some ifdefs to allow either fork or vfork to be used; 
> the current
>       sources just always use vfork, which seems fine to me.

The ifdefs are rather there to switch back to fork() if the vfork() patch
breaks msh.

>   (2) A change to the `grave' function to avoid problems with vfork;
>       since that function appears to do pretty complicated things
>       within the child, Stefan's patch just does (where cp is the
>       command):
> 
>         execlp("/bin/sh", "/bin/sh", "-c", cp, NULL);
> 
>       Not sure if that works, but the current code in `grave' 
> is certain
>       to screw things up when used with vfork.

The grave function is a big mystery to me. I have done some tracing to learn
which parts of it are vfork-safe but then I gave up. The hack using "execlp"
works in most cases but is *slow*. The drawback is that any variables in the
backticks aren't expanded; therefore this won't work,

DIR="/home"
RESULT=`ls -l $DIR`

> So, I'd recommend:
> 
>   Apply my earlier patch to use _exit
> 
>   Think about doing something with the `grave' function 
> similar to what
>   Stefan did.

-Stefan

--
Stefan Soucek, ssoucek at coactive.com
Coactive Networks, 28 Liberty Ship Way, Sausalito, CA 94965
Ph: (415) 289 7840, Fax: (415) 289 1320
This message resent by the uclinux-dev at uclinux.org list server
http://www.uClinux.org/



More information about the uClibc mailing list