[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lost process output in pipe between Emacs and CVS

From: Ian Lance Taylor
Subject: Re: Lost process output in pipe between Emacs and CVS
Date: 19 Jul 2002 20:44:59 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

"Stefan Monnier" <monnier+gnu/emacs/pretest@rum.cs.yale.edu> writes:

> > Derek Robert Price writes:
> > > 
> > > CVS'd have to pipe the child's STDERR through `cat'.  Otherwise the 
> > > child would still share CVS's STDERR and when that got dup'ed to CVS's 
> > > STDOUT, it would share CVS's STDOUT and could set it to non-blocking and 
> > > we're back to the original lost data case.
> > > 
> > > I'm part way to implementing this but it's seg faulting and I don't have 
> > > the time.  If nothing else comes up I'll try to debug it and have 
> > > something out in the next few days.
> > 
> > But that's unnecessary overhead in the vast majority of cases and adds
> > yet another external dependency to CVS.  I think we need to take a step
> > back and think about the overall problem -- this is one of those
> > annoying system failures where all the parts seem to work right in
> > isolation but interfere with each other when combined.  It's not at all
> > clear to me which piece is at fault and should be fixed.
> Completely agreed.  I feel more and more like it might be a problem
> in glibc.

It can be a bit problematical for glibc.  Conceptually, when the stdio
flush routine gets an error calling write(), it could leave the buffer
untouched and return an error indication to the caller.

That should work for fflush() and putc().  The problem comes in
functions like printf().  If a buffer flush fails with EAGAIN during
printf(), what should happen?  If printf() returns an error
indication, it can't indicate how many bytes it wrote into the buffer.
In the case of a large printf(), it might already have flushed the
buffer once, so it is not possible in general for printf() to remove
the characters it added to the buffer.  The result is an indeterminate

The only reasonable answer is to not use printf() with a non-blocking
buffer.  But then why not apply that logic to stdio in general?  Just
don't use stdio with non-blocking buffers.

I don't see a right answer here.  Maybe CVS should include a script
which calls ssh piping stderr to cat, and tell people to use that
instead of using ssh.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]