bug#1261: [BusyBox] bug#1261: Ash holds some extra file descriptors open

Steve Wahl swahl at brecis.com
Thu Aug 1 08:46:03 UTC 2002


On Thu, Aug 01, 2002 at 01:13:40PM +0400, Vladimir N. Oleynik wrote:
> Steve,
>  
> > I have noted that, at least when putting stuff into the background,
> > ash sometimes keeps some file descriptors open that it shouldn't, or
> > at least shouldn't need to.
> > 
> > Small script to reproduce this:
> > 
> > ( (sleep 5 ; echo "hello") 2>&1 | cat >/dev/tty 2>&1 & ) 2>&1 | cat
> > 
> > In many other shells, bash for instance, you will get a command prompt
> > back immediately, then hello comes out 5 seconds later.
> 
> Hmm. Yes. But why not replace to:
> 
> ( (sleep 5 ; echo "hello") 2>&1 | cat >/dev/tty 2>&1) 2>&1 | cat &
> 
> ? I think - this very standart and simply for understanding.

You've changed the meaning of the pipeline.  

Now it is put in the background by a process that has stderr to your
terminal.  That stderr fd is probably still mistakenly held open, it's
just you don't notice it because it points to your terminal, and you
have nothing waiting for it to close.

Remember, the example is just cutting the problem down to the simplest
script that I can make reproduce the problem.  The real script, from
freeswan, that shows the problem, does real, usefull work.  

It runs a few setup programs, puts a program in the background, and
continues, doing a few other things as well, then exits.  It is an rc
script, and it is best to wait for the startup to complete before
continuing to another rc script, to avoid fragmentation of memory (we
are running uclinux).

> > Under ash, the prompt doesn't come back until the 5 seconds expire.
> 
> I can`t reproduce this for ash busybox 0.61pre

That is good to know.  Can I get a copy of 0.61pre somewhere, to verify?

> > Other information: Standalone ash on Red Hat 7.2 (ash-0.3.7-2) seems to
> > have this bug.  Erik Andersen reports that standalone Ash on
> > Debian/Woody does not have the problem.  A comparisson between the two
> > may be helpful.
> 
> Compare size busybox and debian ash ;)

Oh, yes, no question there.  But they do come from a common ancestor,
don't they?  I was suggesting comparing the two large versions might
make it easier to figure out what to change in the small version.  You
know, the much less automated version of:

    diff rh-ash debian-ash | patch busybox-ash

--> Steve Wahl




More information about the busybox mailing list