coreutils
[Top][All Lists]
Advanced

[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: Pádraig Brady
Subject: Re: tee: not checking for EAGAIN or EWOULDBLOCK causing missing output to terminal
Date: Tue, 7 Mar 2023 01:28:05 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Thunderbird/109.0

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:

     https://lists.gnu.org/archive/html/coreutils/2018-09/msg00010.html

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.

cheers,
Pádraig

Attachment: tee-nonblock.patch
Description: Text Data


reply via email to

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