Subject: bug#14246: tee can't continue when receiving SIGPIPE + adding a text mode option

From: Eric Blake <[email-masked]>
Date: Tue, 23 Apr 2013 08:15:11 -0600

On 04/23/2013 06:57 AM, Camion SPAM wrote:
> Hello, I could like to suggest the following patch for tee.
> It addresses the following problems : 
> 1/ Add a new -t parametre to have tee work line per line instead of block by block (Usefull if you use tee to check script results while they are sent to a file or anywhere else

Can't you already get this behavior by wrapping the tee call inside
stdbuf, which is already part of coreutils?

> 2/ Ignores SIGPIPE so that it can close a broken pipe and continue tee-ing on others.
> This is useful when you write things like this 

Questions about how tee should behave on SIGPIPE have been raised in the
past; we need consensus from the Austin Group to see what POSIX requires
to know whether we can change the behavior by default or whether it
requires a command-line option to tee.

> 
> $(some_command | tee /dev/fd/3 | some_processing_1) 3>&1 | processing_2_not_reading_up_to_the_end
> 
> In this case, when processing_2 stops reading, tee will receive SIGPIPE and will be killed preventing processing_1 from receiving it's data.
> 
> Philippe Errembault
> 
> 
> 44a45,48
>> /* If true, read input line per line instead of block per block */
>> static bool text_mode;

Thanks for attempting a patch.  But your patch is worthless; it came
through in 'ed script' patch format, which doesn't work if the file
changes in the meantime.  We specifically ask for unified diff;
preferably from 'git diff', for a reason.

http://git.savannah.gnu.org/cgit/coreutils.git/tree/HACKING

Furthermore, your patch would need documentation and test updates, at
which point is probably no longer trivial, so you would need to assign
copyright to the FSF.  Is this something you are still interested in
pursuing?

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org