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

Vladimir N. Oleynik dzo at simtreas.ru
Thu Aug 1 09:21:05 UTC 2002


Steve,
 
> 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.

Hmm. meaning pipeline...
What meaning in your exampe? Your exampe backrounded also.

> 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.

| cat 2> /dev/null & 
?

> 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.

I remeber.
But, I like not programs with non standart syntax.
  
> > > 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?

http://www.busybox.net have this information.
(Hint: http://www.busybox.net/downloads/snapshots/)

> > > 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?  

Yes. But I rewrote many functions for work without memory streams and
have others file descriptor for stderr, libbb integration and other.

> 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

:))
I not remove features from original source. Only algorithmics optimizations.
You idea not have good result wfor patch ;)


--w
vodz



More information about the busybox mailing list