[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tee: not checking for EAGAIN or EWOULDBLOCK causing missing output t
Re: tee: not checking for EAGAIN or EWOULDBLOCK causing missing output to terminal
Tue, 7 Mar 2023 19:01:59 +0000
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0
On 07/03/2023 14:39, Kamil Dudka wrote:
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!
Thanks for the review.
Updated patch attached with a test.
Description: Text Data