From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 23 09:02:16 2013 Received: (at submit) by debbugs.gnu.org; 23 Apr 2013 13:02:16 +0000 Received: from localhost ([127.0.0.1]:38615 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUcrP-0000qG-Qa for submit@debbugs.gnu.org; Tue, 23 Apr 2013 09:02:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36444) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUcrM-0000q4-NL for submit@debbugs.gnu.org; Tue, 23 Apr 2013 09:02:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUcmT-0007ah-GY for submit@debbugs.gnu.org; Tue, 23 Apr 2013 08:57:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:42325) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUcmT-0007ad-DO for submit@debbugs.gnu.org; Tue, 23 Apr 2013 08:57:09 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUcmQ-00077G-AW for bug-coreutils@gnu.org; Tue, 23 Apr 2013 08:57:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUcmM-0007ZT-Qj for bug-coreutils@gnu.org; Tue, 23 Apr 2013 08:57:06 -0400 Received: from nm23-vm5.bullet.mail.ird.yahoo.com ([212.82.109.234]:38980) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1UUcmM-0007Yh-5Z for bug-coreutils@gnu.org; Tue, 23 Apr 2013 08:57:02 -0400 Received: from [77.238.189.55] by nm23.bullet.mail.ird.yahoo.com with NNFMP; 23 Apr 2013 12:57:00 -0000 Received: from [212.82.108.238] by tm8.bullet.mail.ird.yahoo.com with NNFMP; 23 Apr 2013 12:57:00 -0000 Received: from [127.0.0.1] by omp1003.mail.ird.yahoo.com with NNFMP; 23 Apr 2013 12:57:00 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 303664.87526.bm@omp1003.mail.ird.yahoo.com Received: (qmail 93723 invoked by uid 60001); 23 Apr 2013 12:57:00 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1366721820; bh=WHZs8HambB49L3llhAE/WpeZgGfI9+pc9jK/3BPd4dw=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=wxb/x0I9izu6pYc72uBD6OPEPvfRXgu/bAY9XQE1BFDIjwBT0PTo7eCiWMmGepmE13BkIIZfKATL45clHKhcRayEPiRrEvSfc+k1ZfsoL1ABZftVbDmLW22MRBdZpXtCs5wo+UoVd7uFkQDWGm8kaHZjdXaK/ko3ZZ/ip9qOA+k= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type; b=cPZaSXszQ5RNJfaLe3/UqGG0zq1HLHw40UJnFsplkdm0hrtXkkSpqSuPKgPVRTUysTIa165c4+jXBS7KCsi65bqOfEKQ6SKL6opEOgvZPeZfvTtv5evjXWWmTWutkxNbJMIAd6BKpHGVG9NSPOhwxG5Fw/TrViJJ+GWvhV0d7nM=; X-YMail-OSG: CJlk968VM1kK1G19z7qeelqfGuX9jwTuN5MmJzyJEqhkYgq qnSxlsxMY56qvoFhz9h5YnfC_iO8fCf5q7AUGsCG0dcfBKvS7J_M0BYgtNtC M9.YlD9OY9TRLqdm1CMN93FDjO7h6EYZdtfEousAEAG7_yJr3zRoGf.esUNZ 4K4.Pay7Ul_uYuD80m4yr8dRcVLdtfDEJwozev5GA_V3UwZsLDJDjyIGjBJQ JHOkEtBEZlunFCCc3RtSusF8wE2y5P5FS6Nj5J2m2w9NZSAXZPJCDHQnTaNf 2gbai9Bq5WqJmHGBTPhAIC0swGaWtBobbEks7z6BeusnUyVBT.m3xUF3JFV. H52S4qa9hafaW5qLoIj9N7xPEymxVGnvTu2jP1GGS_b_qrutHltf5FNq6pb7 nSdfotVOMhNyVz62mE72iD8xExZsPKfiNd0z8kI6dN9Cp8NX8AZA79nEJkC1 H0K8Cy3ZE4LMAwYCx2.4YumMQ_ASZGIRLp_d9USstbLZdvMLYySiZcXhuxk5 XG93Z175kCt25SZbEZ_cHcomBY269BT_ewV4EAAVEUPbbe.sunvHDry4dM_7 V6KwZKktDo8qAf6PjRqKGVm5v0HL4d9uqI2PTxTOTfAjBco5vJx3kGnsroP9 nTSaFtr0DVsn9zooLO7fbtVg- Received: from [213.189.160.119] by web133005.mail.ir2.yahoo.com via HTTP; Tue, 23 Apr 2013 13:57:00 BST X-Rocket-MIMEInfo: 002.001, SGVsbG8sIEkgY291bGQgbGlrZSB0byBzdWdnZXN0IHRoZSBmb2xsb3dpbmcgcGF0Y2ggZm9yIHRlZS4KSXQgYWRkcmVzc2VzIHRoZSBmb2xsb3dpbmcgcHJvYmxlbXMgOsKgCjEvIEFkZCBhIG5ldyAtdCBwYXJhbWV0cmUgdG8gaGF2ZSB0ZWUgd29yayBsaW5lIHBlciBsaW5lIGluc3RlYWQgb2YgYmxvY2sgYnkgYmxvY2sgKFVzZWZ1bGwgaWYgeW91IHVzZSB0ZWUgdG8gY2hlY2sgc2NyaXB0IHJlc3VsdHMgd2hpbGUgdGhleSBhcmUgc2VudCB0byBhIGZpbGUgb3IgYW55d2hlcmUgZWxzZQoyLyBJZ25vcmVzIFMBMAEBAQE- X-Mailer: YahooMailWebService/0.8.141.536 Message-ID: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> Date: Tue, 23 Apr 2013 13:57:00 +0100 (BST) From: Camion SPAM Subject: tee can't continue when receiving SIGPIPE + adding a text mode option To: "bug-coreutils@gnu.org" MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-1257869902-774112241-1366721820=:89874" X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Camion SPAM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) ---1257869902-774112241-1366721820=:89874 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Hello, I could like to suggest the following patch for tee.=0AIt addresses = the following problems :=A0=0A1/ Add a new -t parametre to have tee work li= ne per line instead of block by block (Usefull if you use tee to check scri= pt results while they are sent to a file or anywhere else=0A2/ Ignores SIGP= IPE so that it can close a broken pipe and continue tee-ing on others.=0ATh= is is useful when you write things like this=A0=0A=0A$(some_command | tee /= dev/fd/3 | some_processing_1) 3>&1 | processing_2_not_reading_up_to_the_end= =0A=0AIn this case, when processing_2 stops reading, tee will receive SIGPI= PE and will be killed preventing processing_1 from receiving it's data.=0A= =0APhilippe Errembault=0A=0A=0A44a45,48=0A> /* If true, read input line per= line instead of block per block */=0A> static bool text_mode;=0A>=0A>=0A48= a53=0A> =A0 {"text-mode", no_argument, NULL, 't'},=0A67a73=0A> =A0 -t, --te= xt-mode =A0 =A0 =A0 =A0 =A0 copy input line per line instead of block per b= lock\n\=0A97c103=0A< =A0 while ((optc =3D getopt_long (argc, argv, "ai", lo= ng_options, NULL)) !=3D -1)=0A---=0A> =A0 while ((optc =3D getopt_long (arg= c, argv, "ait", long_options, NULL)) !=3D -1)=0A108a115,118=0A> =A0 =A0 =A0= case 't':=0A> =A0 =A0 =A0 =A0 text_mode=3Dtrue;=0A> =A0 =A0 =A0 =A0 =A0 br= eak;=0A>=0A119a130=0A> =A0 signal (SIGPIPE, SIG_IGN);=0A182c193,198=0A< =A0= =A0 =A0 bytes_read =3D read (0, buffer, sizeof buffer);=0A---=0A> =A0 =A0 = =A0 if (text_mode)=0A> =A0 =A0 =A0 {=0A> =A0 =A0 =A0 =A0 bytes_read=3D0;=0A= > =A0 =A0 =A0 =A0 while (bytes_read =A0 =A0 =A0 =A0 =A0 = {=0A> =A0 =A0 =A0 =A0 =A0 ssize_t br =3D read(0, buffer+bytes_read, 1);=0A1= 84,185c200,201=0A< =A0 =A0 =A0 if (bytes_read < 0 && errno =3D=3D EINTR)=0A= < =A0 =A0 =A0 =A0 continue;=0A---> =A0 =A0 =A0 =A0 =A0 if (br < 0 && errno = =3D=3D EINTR)=0A=0A> =A0 =A0 =A0 =A0 =A0 =A0 continue;=0A186a203,221=0A> = =A0 =A0 =A0 =A0 =A0 if (br <=3D 0)=0A> =A0 =A0 =A0 =A0 =A0 =A0 {=0A> =A0 = =A0 =A0 =A0 =A0 =A0 if (bytes_read=3D=3D0)=0A> =A0 =A0 =A0 =A0 =A0 =A0 =A0 = bytes_read=3Dbr;=0A> =A0 =A0 =A0 =A0 =A0 =A0 break;=0A> =A0 =A0 =A0 =A0 =A0= =A0 }=0A>=0A> =A0 =A0 =A0 =A0 =A0 if (buffer[bytes_read++] =3D=3D '\n')=0A= > =A0 =A0 =A0 =A0 =A0 =A0 break;=0A> =A0 =A0 =A0 =A0 =A0 }=0A> =A0 =A0 =A0 = }=0A> =A0 =A0 =A0 else=0A> =A0 =A0 =A0 =A0 {=0A> =A0 =A0 =A0 =A0 bytes_read= =3D read (0, buffer, sizeof buffer);=0A> #ifdef EINTR=0A> =A0 =A0 =A0 =A0 = if (bytes_read < 0 && errno =3D=3D EINTR)=0A> =A0 =A0 =A0 =A0 =A0 continue;= =0A> #endif=0A> =A0 =A0 =A0 =A0 }=0A ---1257869902-774112241-1366721820=:89874 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable
Hello, I could like to suggest the followi= ng 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 t= o check script results while they are sent to a file or anywhere else
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 

$(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 st= ops reading, tee will receive SIGPIPE and will be killed preventing process= ing_1 from receiving it's data.

Philippe Errembault
<= div style=3D"color: rgb(0, 0, 0); font-size: 13px; font-family: arial, helv= etica, sans-serif; background-color: transparent; font-style: normal;">
<= span style=3D"font-size: 13px; background-color: transparent;">
<= /div>
44a45,48
> /* If tr= ue, read input line per line instead of block per block */
> static bool text_mode;
>
>
48a53
>   {"text-m= ode", no_argument, NULL, 't'},
67a73
>   -t, --text-mode   &nbs= p;       copy input line per line instead of block per block\n\
=
97c103
< &= nbsp; while ((optc =3D getopt_long (argc, argv, "ai", long_options, NULL)) = !=3D -1)
---
>   while ((optc =3D getopt_long (argc, argv, "ait", lo= ng_options, NULL)) !=3D -1)
108a115,11= 8
>       case 't':<= /font>
>         text_mode=3Dtrue;
>           break;<= /font>
>
119a130
>   signal (SIGPIP= E, SIG_IGN);
182c193,198
<= div><       bytes_read =3D read (0, b= uffer, sizeof buffer);
---
>       if (text_mode)
>       {
>         bytes_read=3D0;
>         while (bytes_read<size= of buffer)
>       &= nbsp;   {
>           ss= ize_t br =3D read(0, buffer+bytes_read, 1);
184,185c200,201
<   &nbs= p;   if (bytes_read < 0 && errno =3D=3D EINTR)
=
---1257869902-774112241-1366721820=:89874-- From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 23 10:20:18 2013 Received: (at 14246) by debbugs.gnu.org; 23 Apr 2013 14:20:18 +0000 Received: from localhost ([127.0.0.1]:39068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUe4v-0005SG-Fi for submit@debbugs.gnu.org; Tue, 23 Apr 2013 10:20:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22412) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUe4p-0005Rr-CI for 14246@debbugs.gnu.org; Tue, 23 Apr 2013 10:20:15 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3NEFCjP018520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Apr 2013 10:15:12 -0400 Received: from [10.3.113.109] (ovpn-113-109.phx2.redhat.com [10.3.113.109]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3NEFBjd022971; Tue, 23 Apr 2013 10:15:11 -0400 Message-ID: <5176976F.7030906@redhat.com> Date: Tue, 23 Apr 2013 08:15:11 -0600 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: Camion SPAM Subject: Re: bug#14246: tee can't continue when receiving SIGPIPE + adding a text mode option References: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> In-Reply-To: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> X-Enigmail-Version: 1.5.1 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2LRDIQRALCTLCSJPAASFC" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 14246 Cc: 14246@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2LRDIQRALCTLCSJPAASFC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 :=20 > 1/ Add a new -t parametre to have tee work line per line instead of blo= ck by block (Usefull if you use tee to check script results while they ar= e 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=20 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. >=20 > $(some_command | tee /dev/fd/3 | some_processing_1) 3>&1 | processing_2= _not_reading_up_to_the_end >=20 > In this case, when processing_2 stops reading, tee will receive SIGPIPE= and will be killed preventing processing_1 from receiving it's data. >=20 > Philippe Errembault >=20 >=20 > 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? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2LRDIQRALCTLCSJPAASFC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRdpdvAAoJEKeha0olJ0Nqd64IAJ5m6+68PGrnJ7h2WVoqXixy Ok+O9cMRVzPijCo831CPn3CaWoowIZxXYooxg7ySRQvNrPR0wvRg/McqTrLzIq22 NAV4kGQBnRurHuPTyFeQZ5fDGm/kVfxu5jt3PlwIKcsDP2YP5t/RniD3447GA36d KT+Aw/P0Yo352UTcGzUpg1p/exZNtzQwfkasnMyMBbVwYujYiuasqFGIRy3kRiCE pV/kTggFjt3tiZBOEf9tUtLjG1m2iheR1lZBRoX9p0bxSb9Dt7vXBocsbtQQKaZq +9wTkao51hJT8+YNhXGpunmTxxCVxthiKdX8rCJjrStP9xEn1KQGdyPx1Upqz+U= =fmRg -----END PGP SIGNATURE----- ------enig2LRDIQRALCTLCSJPAASFC-- From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 23 12:04:02 2013 Received: (at 14246) by debbugs.gnu.org; 23 Apr 2013 16:04:02 +0000 Received: from localhost ([127.0.0.1]:39203 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUfhJ-0002y1-Fq for submit@debbugs.gnu.org; Tue, 23 Apr 2013 12:04:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49179) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUfhF-0002xi-Mk for 14246@debbugs.gnu.org; Tue, 23 Apr 2013 12:03:59 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3NFwwK2005432 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 23 Apr 2013 11:58:59 -0400 Received: from [10.36.116.99] (ovpn-116-99.ams2.redhat.com [10.36.116.99]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3NFwt9t021040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 23 Apr 2013 11:58:57 -0400 Message-ID: <5176AFBF.6020103@draigBrady.com> Date: Tue, 23 Apr 2013 16:58:55 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Camion SPAM Subject: Re: bug#14246: tee can't continue when receiving SIGPIPE + adding a text mode option References: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> In-Reply-To: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r3NFwwK2005432 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: 14246 Cc: 14246@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) On 04/23/2013 01:57 PM, Camion SPAM wrote: > Hello, I could like to suggest the following patch for tee. > It addresses the following problems :=20 > 1/ Add a new -t parametre to have tee work line per line instead of blo= ck by block (Usefull if you use tee to check script results while they ar= e sent to a file or anywhere else tee works in non buffered mode by default so I need to consider the implications of "text mode". > 2/ Ignores SIGPIPE so that it can close a broken pipe and continue tee-= ing on others. The more general tee --write-error=3D{[cont],ignore,exit} should handle this http://bugs.gnu.org/11540 It's nearly at the top of my TODO list. > This is useful when you write things like this=20 >=20 > $(some_command | tee /dev/fd/3 | some_processing_1) 3>&1 | processing_2= _not_reading_up_to_the_end >=20 > In this case, when processing_2 stops reading, tee will receive SIGPIPE= and will be killed preventing processing_1 from receiving it's data. thanks, P=E1draig. From debbugs-submit-bounces@debbugs.gnu.org Tue Apr 23 15:50:51 2013 Received: (at 14246) by debbugs.gnu.org; 23 Apr 2013 19:50:51 +0000 Received: from localhost ([127.0.0.1]:39552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UUjEo-0004qb-I6 for submit@debbugs.gnu.org; Tue, 23 Apr 2013 15:50:50 -0400 Received: from nm24-vm3.bullet.mail.ird.yahoo.com ([212.82.109.194]:24178) by debbugs.gnu.org with smtp (Exim 4.72) (envelope-from ) id 1UUjEl-0004qR-RD for 14246@debbugs.gnu.org; Tue, 23 Apr 2013 15:50:49 -0400 Received: from [77.238.189.50] by nm24.bullet.mail.ird.yahoo.com with NNFMP; 23 Apr 2013 19:45:48 -0000 Received: from [212.82.108.121] by tm3.bullet.mail.ird.yahoo.com with NNFMP; 23 Apr 2013 19:45:48 -0000 Received: from [127.0.0.1] by omp1030.mail.ird.yahoo.com with NNFMP; 23 Apr 2013 19:45:48 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 5433.324.bm@omp1030.mail.ird.yahoo.com Received: (qmail 93359 invoked by uid 60001); 23 Apr 2013 19:45:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.fr; s=s1024; t=1366746346; bh=rivaSp5ygNjZP4FziCUYh9Y9UB/1HqjoEx0op+KDcls=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=0ogoDufQoNITDXEDaMFrYOy6HG73MKO3g/ksNI83gNetbQLE888eH2TjwYzZRZYTt9Om4DmlvAYWH+yPQ+Yq/PxEmH9WNwzynNc20v1YFrSNzTS3ohhbZnMmgRMWN2o642CPxyPd5yELV6CMXumSoM1jsINfy+lpHwJROY+AX/k= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:References:Message-ID:Date:From:Reply-To:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=rk68rglteV9kunqHVdmUB3oeNaep6h9VnQeY2JVIDPULfd1B8mnB27C1wb4UAHRgPavVk7W+inkJl87miXTvrAcwvWz64Cx4MXN8qa7UASSor82Vr50jeVHAMQEdWNPdWuADX5PpD+15+eve+rfzS+PbgzjcHJS62Hl2qCMtgFw=; X-YMail-OSG: F5j9jNkVM1nKTU9y7NN5PdTZ_deDLdPQceWiz1pdbtLkoNj uLI5Oi9gstvAzeOHwDi7s_Ya88C028S.fFQLoJGoJTmjGAFikZUt.CjNmQ6_ wtPiBRqmRSebxgc7qhO0nUsBKYAI3UL4LzFLXeWNo_oGB1EQGTkbN3S_kXxZ UqcpSrqmwVpuc4nNwD9bOdehaOgoTfaBbsSEz1_AZr7E4ChJ3UfRzcjlFn8t xbLSjf6NswdhRL0vHV6g5ibm0U_tOlu3NpO.qSL8D7xfAOIGKAZ3pdThopq8 IqS2XNpxB6Yaz4AOnhepYpT8lbQZT1Cw5V7Jfjno.b6k9AsLm_w2x4q6Emij PNrNYVe7Dto1DeTiAz04jiQbbU_vfH0cYN3hVReJtVKeMBn6Pj2ume.p.DD1 MbBi05fIB7jogINcjxVUOVS1oFHooJfhOjOSrSTwT.IKcgRmNmhkBOe9ceM0 QQ9h7M36qjzuSlYtz9Sjz1hZ5GYELU_5XqRHzPTSc9iHPAR38El7sheSXKcF AkY12Rv4lhMOh5HXtjFUZKBWKjOEveSuNk_kEkjC_tasvo4Ik57Tg5cnWTFI mbjLOwg-- Received: from [213.189.160.119] by web133006.mail.ir2.yahoo.com via HTTP; Tue, 23 Apr 2013 20:45:46 BST X-Rocket-MIMEInfo: 002.001, RXJpYyBCbGFrZSB3cm90ZSA6wqAKCj7CoENhbid0IHlvdSBhbHJlYWR5IGdldCB0aGlzIGJlaGF2aW9yIGJ5IHdyYXBwaW5nIHRoZSB0ZWXCoAo.IGNhbGwgaW5zaWRlwqBzdGRidWYsIHdoaWNoIGlzIGFscmVhZHkgcGFydCBvZiBjb3JldXRpbHM_CnN0ZGJ1ZiBpcyBub3QgdXNhYmxlIHRvIHNldCBzdGRpbiBpbiBsaW5lIG1vZGUsIGFuZCBieSB0aGUgd2F5IHRlZSBpcyBub3QgYnVmZmVyZWQuCgpFcmljIEJsYWtlIHdyb3RlIDrCoAoKPiBRdWVzdGlvbnMgYWJvdXQgaG93IHRlZSBzaG91bGQgYmVoYXZlIG8BMAEBAQE- X-Mailer: YahooMailWebService/0.8.141.536 References: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> <5176AFBF.6020103@draigBrady.com> Message-ID: <1366746346.90545.YahooMailNeo@web133006.mail.ir2.yahoo.com> Date: Tue, 23 Apr 2013 20:45:46 +0100 (BST) From: Camion SPAM Subject: Re: bug#14246: tee can't continue when receiving SIGPIPE + adding a text mode option To: =?iso-8859-1?Q?P=E1draig_Brady?= , Eric Blake In-Reply-To: <5176AFBF.6020103@draigBrady.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-2132240502-417187254-1366746346=:90545" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 14246 Cc: "14246@debbugs.gnu.org" <14246@debbugs.gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Camion SPAM List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) ---2132240502-417187254-1366746346=:90545 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Eric Blake wrote :=A0=0A=0A>=A0Can't you already get this behavior by wrapp= ing the tee=A0=0A> call inside=A0stdbuf, which is already part of coreutils= ?=0Astdbuf is not usable to set stdin in line mode, and by the way tee is n= ot buffered.=0A=0AEric Blake wrote :=A0=0A=0A> Questions about how tee shou= ld behave on SIGPIPE have been raised in the=0A> past; we need consensus fr= om the Austin Group to see what POSIX requires=0A> to know whether we can c= hange the behavior by default or whether it=0A> requires a command-line opt= ion to tee.=0A=0AIMO, the only reason for not catching SIGPIPE, is if one w= ishes processing_2 to be=A0=0Aable to stop processing_1 by stopping the rea= ding. It seems a bit awkwards to me,=A0=0Abut=A0why not. I'm not one who ha= s the right to criticise other people strange=A0=0Ascripting=A0methods ;-D= =0A=0AP=E1draig Brady wrote :=A0=0A> The more general tee --write-error=3D{= [cont],ignore,exit}=0A> should handle this http://bugs.gnu.org/11540=0A> It= 's nearly at the top of my TODO list.=0AIt's not the same. Catching SIGPIPE= is not about continuing on error,=A0=0Abut about only=A0stopping the outpu= t with the error, and not the others=A0=0A(when you have more than one outp= ut.)=A0=0ABoth would probably complementary.=0A=0AP=E1draig Brady wrote := =A0=0A> tee works in non buffered mode by default=0A> so I need to consider= the implications of=A0 "text mode".=0A=0AThe patch I suggested is also wor= king in non buffered mode=0AI called it text mode, only because it stops re= ading at every '\n'=0ASince it is mostly useful when you get input from a p= ipe and=A0=0Awant=A0output to appear line by=A0line in screen, performance= =A0=0Ashould not be too much of a problem.=0A=0ABest regards ---2132240502-417187254-1366746346=:90545 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable ---2132240502-417187254-1366746346=:90545-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 18 20:13:42 2018 Received: (at 14246) by debbugs.gnu.org; 19 Oct 2018 00:13:42 +0000 Received: from localhost ([127.0.0.1]:57684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDIQ9-0005OR-Nq for submit@debbugs.gnu.org; Thu, 18 Oct 2018 20:13:41 -0400 Received: from mail-pg1-f179.google.com ([209.85.215.179]:40621) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gDIQ5-0005O6-CW; Thu, 18 Oct 2018 20:13:37 -0400 Received: by mail-pg1-f179.google.com with SMTP id n31-v6so14948282pgm.7; Thu, 18 Oct 2018 17:13:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=Yv9rxUjWejDmPYiKvVCe1kK5fpd4Vv1nGcQYS1GWZNs=; b=FxV+OzSY14WNd1tpLgMK9BZsQSHBExfeL5IgzeCzXTzSJOP4KrDs6BjZ881pwPGyLT IFttbqCBSCMbC72ckOEpUGfK9KsBFtzlTfd4GSbu7dclx0aj3k+vwauIRGFqZODgv6i4 et0yidu+MBlF5kjEQ5hCHarwiIeJ1XVEnD8LFaCQBW8IkegN7CdMAFpOzyiMfuS1G6r2 zQUqJnAeikjk9iBYdLttaQK5ES0DZKTQD4BGHtCv/zZUMplvnMVrAugd74Pr1q7I1Md6 Ta1zxmv6/lK4c9Ti9Viajx3dzQmJytAaMXu76sCDCyLPXblUTw/TrOJDUZ2rvTAmzP/t 0Org== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Yv9rxUjWejDmPYiKvVCe1kK5fpd4Vv1nGcQYS1GWZNs=; b=lizK7ZrZfqR/XnJ4SV6pgOidMc7dTBBckFqGirdWY8FbdZqkHzvW6HfRHM66JRwEzx wUWgOGHM2K1c2K55guRkOV95tpG+33JDPuevgpnPnh4XBKDOKipfZ237WkfHhAHl16Yq WqpMeUCK6HHKLm+2/cQ8Lppje52N9C6lQUSyfyeXTinshyTF+x/wA2U0fJL1DdkMF+rP fh2264kt6qd7Mt7vj8BmoXJWoV9QbefBgmCICHoyQq4Gw62j/hpwfZQd57/x3GwRbKBh 70R5jqEaZWXCY9cjsr+IUwfOjlNjSJACgV7fd7WBnj6jqAq88K3qmNX9UOzzX2ZqlEm/ pARA== X-Gm-Message-State: ABuFfogaS9fw7SEQe5poDuvyQcQ6Jh8Wtkkzf4TNmE8rI/L5gGNt3K2K WB0GpGtkcoA8HJd5auStzl6HfPLxZcw= X-Google-Smtp-Source: ACcGV63ai3cJjSy6HwjEQpeFSDfdxCcb8pbG5KZrKn6agstadXncayeu1Uk9B4SCJZFOp2Bs5rJHHg== X-Received: by 2002:a63:fe44:: with SMTP id x4-v6mr30554197pgj.152.1539908011246; Thu, 18 Oct 2018 17:13:31 -0700 (PDT) Received: from tomato.housegordon.com (moose.housegordon.com. [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id u12-v6sm283626pgn.56.2018.10.18.17.13.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 17:13:30 -0700 (PDT) Subject: Re: bug#14246: tee can't continue when receiving SIGPIPE + adding a text mode option To: "14246@debbugs.gnu.org" <14246@debbugs.gnu.org> References: <1366721820.89874.YahooMailNeo@web133005.mail.ir2.yahoo.com> <5176AFBF.6020103@draigBrady.com> <1366746346.90545.YahooMailNeo@web133006.mail.ir2.yahoo.com> From: Assaf Gordon Message-ID: <18e6d244-26b0-792d-a8f0-02eab2519aea@gmail.com> Date: Thu, 18 Oct 2018 18:13:29 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1366746346.90545.YahooMailNeo@web133006.mail.ir2.yahoo.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 14246 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 14246 fixed close 14246 stop (triaging old bugs) In coreutils version 8.24 (released 2015) 'tee' gained the '--output-error=MODE' option, enabling SIGPIPE handling. I'm marking this as "fixed" and closing. regards, - assaf From unknown Sat Jun 21 12:12:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 16 Nov 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator
Eric Blake wrote :&n= bsp;
Can't you already get this b= ehavior by wrapping the tee 
&= gt; call inside stdbuf,= which is already part of coreutils?
stdbuf = is not usable to set stdin in line mode, and by the way tee is not buffered= .

Eric Blake wrote : 
> Questions about h= ow tee should behave on SIGPIPE have been raised in the
> past; we ne= ed consensus from the Austin Group to see what POSIX requires
> to kn= ow whether we can change the behavior by default or whether it
> requ= ires a command-line option to tee.
= IMO, the only reason for not catching SIGPIPE, is if one wishes processing_= 2 to be 
able to stop processing_1 by st= opping the reading. It seems a bit awkwards to me, 
but why not. I'm not one who has the r= ight to criticise other people strange 
scripting methods ;-D

P=E1draig Brady wrote : 
=
> The mo= re general tee --write-error=3D{[cont],ignore,exit}
> sh= ould handle this http://bugs.gnu.org/11540
> It's nearly = at the top of my TODO list.
It's not the same= . Catching SIGPIPE is not about continuing on error, 
but about only = stopping the output with the error, and not the others 
(when you have more than one output.= ) 
Both would probably complementary.
=
<= span style=3D"font-family: Arial; font-size: 13px; background-color: transp= arent;">P=E1draig Brady wrote : 
> tee works in non buffered mode by default
> so I need to consider the implications of  "text mod= e".
The patch I= suggested is also working in non buffered mode
I called it text mode, only because it stops reading at = every '\n'
Since it is mostly= useful when you get input from a pipe and 
want output to appear line by line in screen, performance 
should not be too = much of a problem.

Best regards