Bug in sh (was: Re: [BusyBox] BB Init and rcS script)

Fabrice Gautier gautier at email.enst.fr
Tue Mar 13 03:31:13 UTC 2001


Okay,

I'm still trying to figure out what's going on. several clues:

The first thing is that the problem is in sh not in echo. I can reporudc
the problem just putting ">" on the command line

I can reproduce the bug on my debian. Sometimes I've to type two time
the command before it crashes.

I added some debug_printf to see where the problem was.
The segmentation fault is caused byt the line

lenght=strlen(expand_result.we_wordv[i])+1

int the expand_argument function in sh.c (line ~950)

I printf-ed the value of expand_result.we_wordv and it was smething like
0xbffffbac when it crashed while the other calls printf-ed was something
in the 0x8000000.

It seems that the wordexp() call returns bad pointers in this case.

So I modified two ifdef to do as if wordexp wasn't available. But this
didn't solve the problem. It crashes less easily but still have some
segfault error.

So this may not be wordexp fault, but there is probably a memory related
pb here.


Thanks


On Tue, 13 Mar 2001 00:54:10 +0100
Fabrice Gautier <gautier at email.enst.fr> wrote:

> Hi, more input,
> 
> The rcS script is terminated with a signal 11 (SIGSEGV).
> 
> The faulty line appears to be:
> 
> echo > /etc/mtab
> 
> When I remove this line form the script all goes well.
> So after that I have the busybox shell and if i try "echo > test"
> then the shell exit.
> 
> I tried the same thing on my host linux box (a debian unstable)
> chrooting on the same filesystem, and I didn't succeded to reproduce the
> problem,...
> 
> My target has a STPC x86, detected as a Cyrix 486 core by a 2.4 kernel,
> while the debian box run a 2.2.18 kernel on a k6-2.
> 
> Thanks...
> 
> 
> On Mon, 12 Mar 2001 22:59:41 +0100
> Fabrice Gautier <gautier at email.enst.fr> wrote:
> 
> > Hi,
> > 
> > I'm using BB init to boot. I'm using an NFS root and a Serial console.
> > 
> > I don't have /etc/inittab, so /etc/init.d/rcS is used a the startup
> > script.
> > 
> > The beginning of the script run well, but then it appears to be
> > interupted and i have the message "Please press Enter to activate this console."
> > 
> > The script appears to be interrupted in the middle of an echo command 
> > (it onyl output an half word)
> > 
> > If I type enter , i get in the shell and i can verify that the script
> > has not finished (/proc is not mounted)
> > 
> > What's happening?
> > 
> > Thanks
> > -- 
> > Fabrice Gautier <gautier at email.enstfr>
> > 
> > 
> > 
> > _______________________________________________
> > busybox mailing list
> > busybox at busybox.net
> > http://busybox.net/mailman/listinfo/busybox
> 
> -- 
> Fabrice Gautier <gautier at email.enstfr>
> 
> 
> 
> _______________________________________________
> busybox mailing list
> busybox at busybox.net
> http://busybox.net/mailman/listinfo/busybox

-- 
Fabrice Gautier <gautier at email.enstfr>






More information about the busybox mailing list