[Top][All Lists]

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

Re: tee: not checking for EAGAIN or EWOULDBLOCK causing missing output t

From: Kamil Dudka
Subject: Re: tee: not checking for EAGAIN or EWOULDBLOCK causing missing output to terminal
Date: Tue, 07 Mar 2023 15:39:48 +0100

On Tuesday, March 7, 2023 2:28:05 AM CET Pádraig Brady wrote:
> On 25/07/2019 11:59, Kamil Dudka wrote:
> > I see two major issues with the patch:
> > 
> > 1. If the file descriptor operates in non-blocking mode and it starts
> > to return EAGAIN, tee will busy-loop (consume 100% CPU) until the file
> > descriptor becomes ready again.
> > 
> > 2. If fwrite() fails with EAGAIN, you cannot repeat the call with the same
> > arguments because something might have been already written before EAGAIN 
> > was
> > returned from a syscall.  In that case, you would try to write the already
> > written data repeatedly, which is not desired.
> > 
> > A few months ago I proposed a patch that was free of the above issues but it
> > addressed EAGAIN on tee's output only:
> > 
> >
> > 
> > The bad news is that the patch was rejected because a workaround exists.
> Given there are now two programs that trigger the issue,
> and we've recently added portable poll() usage in the tee implementation,
> I'm more inclined to add support for this now.
> The attached does this using our new iopoll module.

The proposed patch works for me.  Thank you for working on it!


> cheers,
> Pádraig

reply via email to

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