From unknown Sat Jun 14 03:49:31 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#8565 <8565@debbugs.gnu.org> To: bug#8565 <8565@debbugs.gnu.org> Subject: Status: gzip/bzip2/output-hook support for split Reply-To: bug#8565 <8565@debbugs.gnu.org> Date: Sat, 14 Jun 2025 10:49:31 +0000 retitle 8565 gzip/bzip2/output-hook support for split reassign 8565 coreutils submitter 8565 Ari Pollak severity 8565 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 27 02:45:58 2011 Received: (at submit) by debbugs.gnu.org; 27 Apr 2011 06:45:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QEyVV-0006VL-I2 for submit@debbugs.gnu.org; Wed, 27 Apr 2011 02:45:57 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QEwPA-0003QK-IJ for submit@debbugs.gnu.org; Wed, 27 Apr 2011 00:31:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEwP4-0001gB-78 for submit@debbugs.gnu.org; Wed, 27 Apr 2011 00:31:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:56108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEwP4-0001g7-5e for submit@debbugs.gnu.org; Wed, 27 Apr 2011 00:31:06 -0400 Received: from eggs.gnu.org ([140.186.70.92]:48245) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEwP2-0001FD-Ru for bug-coreutils@gnu.org; Wed, 27 Apr 2011 00:31:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QEwP0-0001fu-CO for bug-coreutils@gnu.org; Wed, 27 Apr 2011 00:31:04 -0400 Received: from mail-iy0-f169.google.com ([209.85.210.169]:57049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QEwP0-0001fq-7L for bug-coreutils@gnu.org; Wed, 27 Apr 2011 00:31:02 -0400 Received: by iyh42 with SMTP id 42so1515384iyh.0 for ; Tue, 26 Apr 2011 21:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to :content-type; bh=2dvB4rg0820LsRs3tyskTe6wfITnqSY8KjIDFi6+l8U=; b=JlikO8GCFNgjaWIGulOIUfKhCeRGphbNglf4lWROxzptXL8LiW0AkRV+hyyY3ifz7U Gk5+tqHRdspyP1/v678EkBvX+LQiiR1nWxO0+u6E1RsfEtqugewzwZ2lV9puXdAA1FHr ViE1pbexrqnBxN+rKukhTg1h7RQXrIHhFTdeo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=LUm/KCiwxoB1l9+bGVmEkWY8J/E+svmTesd7TVugoC91C+pRNODqU7HvDEDhBtSJ9c STLut6kRDW2EV6uMySzcchocm0ZTi7sGA5tgZvpBh0D1V90sFvbiVHmeLiOH8/GxeRjs RUBzE/K09Bk9EZzPSwQCMkKKjeiEV2zE4O5Bc= Received: by 10.42.140.193 with SMTP id l1mr2110642icu.119.1303878661106; Tue, 26 Apr 2011 21:31:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.221.130 with HTTP; Tue, 26 Apr 2011 21:30:41 -0700 (PDT) From: Ari Pollak Date: Wed, 27 Apr 2011 00:30:41 -0400 Message-ID: Subject: gzip/bzip2/output-hook support for split To: bug-coreutils@gnu.org Content-Type: multipart/mixed; boundary=90e6ba47695b6ceb1404a1dee830 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -5.9 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 27 Apr 2011 02:45:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -5.9 (-----) --90e6ba47695b6ceb1404a1dee830 Content-Type: text/plain; charset=UTF-8 I've been sitting on this for a few months expecting to finish it, but still haven't found the time, so I'm just putting it out there now so it isn't lost entirely. It's originally from Chandrakumar Muthaiah: http://article.gmane.org/gmane.comp.gnu.coreutils.bugs/15684 I applied it to the latest git, added some tests, and cleaned it up a bit. --90e6ba47695b6ceb1404a1dee830 Content-Type: text/x-patch; charset=US-ASCII; name="output-hook.diff" Content-Disposition: attachment; filename="output-hook.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gmzrnxqc0 ZGlmZiAtLWdpdCBhL3NyYy9zcGxpdC5jIGIvc3JjL3NwbGl0LmMKaW5kZXggM2E2MzBhMC4uOGRk MTU3MSAxMDA2NDQKLS0tIGEvc3JjL3NwbGl0LmMKKysrIGIvc3JjL3NwbGl0LmMKQEAgLTEzLDcg KzEzLDcgQEAKIAogICAgWW91IHNob3VsZCBoYXZlIHJlY2VpdmVkIGEgY29weSBvZiB0aGUgR05V IEdlbmVyYWwgUHVibGljIExpY2Vuc2UKICAgIGFsb25nIHdpdGggdGhpcyBwcm9ncmFtLiAgSWYg bm90LCBzZWUgPGh0dHA6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F0ZSAoY29uc3QgY2hhciogbmFtZSkK ICAgICAgICAgICAgICAgIChTX0lSVVNSIHwgU19JV1VTUiB8IFNfSVJHUlAgfCBTX0lXR1JQIHwg U19JUk9USCB8IFNfSVdPVEgpKTsKIH0KIAorLyogT3BlbnMgYSBuZXcgZmQgYmFzZWQgb24gdGhl IGZpbGUgdHlwZSBzZWxlY3Rpb24gKi8KKworc3RhdGljIGludAorZmRwb3BlbiAoIGNvbnN0IGNo YXIgKmNvbW1hbmQsIGNvbnN0IGNoYXIgKm1vZGUpCit7CisgIGludCBwYXJlbnRfZW5kLCBjaGls ZF9lbmQ7CisgIGludCBwaXBlX2Zkc1syXTsKKyAgcGlkX3QgY2hpbGRfcGlkOworCisgIGludCBk b193cml0ZSA9IDA7CisgIGludCBkb19jbG9leGVjID0gMDsKKworICB3aGlsZSAoKm1vZGUgIT0g J1wwJykKKyAgICB7CisgICAgICBzd2l0Y2ggKCptb2RlKyspCisgICAgICAgIHsKKyAgICAgICAg Y2FzZSAndyc6CisgICAgICAgICAgZG9fd3JpdGUgPSAxOworICAgICAgICAgIGJyZWFrOworICAg ICAgICBjYXNlICdlJzoKKyAgICAgICAgICBkb19jbG9leGVjID0gMTsKKyAgICAgICAgICBicmVh azsKKyAgICAgICAgZGVmYXVsdDoKKyAgICAgICAgICBlcnJubyA9IEVJTlZBTDsKKyAgICAgICAg ICByZXR1cm4gLTE7CisgICAgICAgIH0KKyAgICB9CisKKyAgaWYgKHBpcGUgKHBpcGVfZmRzKSA8 IDApCisgICAgcmV0dXJuIC0xOworCisgIHBhcmVudF9lbmQgPSBwaXBlX2Zkc1sxXTsKKyAgY2hp bGRfZW5kID0gcGlwZV9mZHNbMF07CisgIGNoaWxkX3BpZCA9IGZvcmsgKCk7CisKKyAgaWYgKGNo aWxkX3BpZCA9PSAwKQorICAgIHsKKyAgICAgIGludCBjaGlsZF9zdGRfZW5kID0gMDsgLyogTWFr ZSB0aGlzIGFzIHRoZSBzdGRpbiBmaWxlIGRlc2NyaXB0b3IgKi8KKyAgICAgIGNsb3NlIChwYXJl bnRfZW5kKTsKKworICAgICAgaWYgKGNoaWxkX2VuZCAhPSBjaGlsZF9zdGRfZW5kKQorICAgICAg ICB7CisgICAgICAgICAgZHVwMiAoY2hpbGRfZW5kLCBjaGlsZF9zdGRfZW5kKTsKKyAgICAgICAg ICBjbG9zZSAoY2hpbGRfZW5kKTsKKyAgICAgICAgfQorCisgICAgICAvKiBUT0RPOiBnZXQgcmlk IG9mIHRoaXMgc2gsIHBpcGUgdG8gdGhlIG91dHB1dCBpbiBDICovCisgICAgICBleGVjbCAoIi9i aW4vc2giLCAic2giLCAiLWMiLCBjb21tYW5kLCAoY2hhciAqKSAwKTsKKyAgICAgIF9leGl0ICgx MjcpOworICAgIH0KKworICBjbG9zZSAoY2hpbGRfZW5kKTsKKyAgaWYgKGNoaWxkX3BpZCA8IDAp CisgICAgeworICAgICAgY2xvc2UgKHBhcmVudF9lbmQpOworICAgICAgcmV0dXJuIC0xOworICAg IH0KKworICBpZiAoZG9fY2xvZXhlYykKKyAgICBmY250bCAocGFyZW50X2VuZCwgRl9TRVRGRCwg RkRfQ0xPRVhFQyk7CisKKyAgcmV0dXJuIHBhcmVudF9lbmQ7Cit9CisKK3N0YXRpYyB2b2lkCitu ZXdfZmRfcGlwZSAoKQoreworICAvKiAnZ3ppcCA8IC8xLzIvMy80LzUvb3V0cHV0ZmlsZS5neicg Ki8KKworICBzaXplX3Qgb3V0emxlbmd0aCA9IHN0cmxlbiAob3V0aG9vayk7CisgIHNpemVfdCBv dXRsZW5ndGggID0gc3RybGVuIChvdXRmaWxlKTsKKyAgc2l6ZV90IHN1Zmxlbmd0aCAgPSBzdHJs ZW4gKG91dGhvb2tzdWYpOworICBzaXplX3QgdGxlbmd0aCAgICA9IG91dHpsZW5ndGggKyBvdXRs ZW5ndGggKyBzdWZsZW5ndGggKyAzOworCisgIGNoYXIqIG91dGZpbGV6ICAgID0geG1hbGxvYyAo dGxlbmd0aCArIDE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gICAgICAgICAg aW50IHN0YXR1czsKKyAgICAgICAgICB3YWl0cGlkICgtMSwgJnN0YXR1cywgMCk7IC8qIEZJWE1F OiBjaGVjayBzdGF0dXMgKi8KKyAgICAgICAgICBuZXdfZmRfcGlwZSAoKTsKKyAgICAgICAgfQor ICAgICAgZWxzZQorICAgICAgICB7CisJICBpZiAoKG91dHB1dF9kZXNjID0gY3JlYXRlIChvdXRm aWxlKSkgPCAwKQorCSAgICBlcnJvciAoRVhJVF9GQUlMVVJFLCBlcnJubywgIiVzIiwgb3V0Zmls ZSk7CisgICAgICAgIH0KICAgICB9CisKICAgaWYgKGZ1bGxfd3JpdGUgKG91dHB1dF9kZXNjLCBi cCwgYnl0ZXMpICE9IGJ5dGVzKQogICAgIGVycm9yIChFWElUX0ZBSUxVUkUsIGVycm5vLCAiJXMi LCBvdXRmaWxlKTsKIH0KQEAgLTgyNCw3ICs5MzIsNyBAQCBtYWluIChpbnQgYXJnYywgY2hhciAq KmFyZ3YpCiAgICAgICBpbnQgdGhpc19vcHRpbmQgPSBvcHRpbmQgPyBvcHRpbmQgOiAxOwogICAg ICAgY2hhciAqc2xhc2g7CiAKLSAgICAgIGMgPSBnZXRvcHRfbG9uZyAoYXJnYywgYXJndiwgIjAx MjM0NTY3ODlDOmE6YjpkZWw6bjp1IiwgbG9uZ29wdHMsIE5VTEwpOworICAgICAgYyA9IGdldG9w dF9sb25nIChhcmdjLCBhcmd2LCAiMDEyMzQ1Njc4OUM6YTpiOmRlazpsOm46czp1IiwgbG9uZ29w dHMsIE5VTEwpOwogICAgICAgaWYgKGMgPT0gLTEpCiAgICAgICAgIGJyZWFrOwogCkBAIC05NjUs NiArMTA3MywxMyBAQCBtYWluIChpbnQgYXJnYywgY2hhciAqKmFyZ3YpCiAgICAgICAgICAgICBl bHNlCiAgICAgICAgICAgICAgIGluX2Jsa19zaXplID0gdG1wX2Jsa19zaXplOwogICAgICAgICAg IH0KKworICAgICAgICBjYXNlICdrJzoKKyAgICAgICAgICB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gLWYgeGFhICYm IGZhaWw9MQordGVzdCAtZiB4YWQuZ3ogJiYgZmFpbD0xCisKK0V4aXQgJGZhaWwK --90e6ba47695b6ceb1404a1dee830-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 27 16:26:06 2011 Received: (at 8565) by debbugs.gnu.org; 27 Apr 2011 20:26:06 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFBJF-0000q0-50 for submit@debbugs.gnu.org; Wed, 27 Apr 2011 16:26:05 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFBJC-0000pW-GA for 8565@debbugs.gnu.org; Wed, 27 Apr 2011 16:26:03 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id B2C00600E1; Wed, 27 Apr 2011 22:25:56 +0200 (CEST) From: Jim Meyering To: Ari Pollak Subject: Re: bug#8565: gzip/bzip2/output-hook support for split In-Reply-To: (Ari Pollak's message of "Wed, 27 Apr 2011 00:30:41 -0400") References: Date: Wed, 27 Apr 2011 22:25:56 +0200 Message-ID: <87zknb30h7.fsf@rho.meyering.net> Lines: 18 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8565 Cc: 8565@debbugs.gnu.org, sudhach@chandrasudha.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (------) Ari Pollak wrote: > I've been sitting on this for a few months expecting to finish it, but > still haven't found the time, so I'm just putting it out there now so > it isn't lost entirely. It's originally from Chandrakumar Muthaiah: > http://article.gmane.org/gmane.comp.gnu.coreutils.bugs/15684 > I applied it to the latest git, added some tests, and cleaned it up a bit. Thank you for working on that. However, we still don't have a copyright assignment from Chandrakumar Muthaiah. Chandrakumar, have you started the process? http://git.sv.gnu.org/cgit/coreutils.git/tree/HACKING#n429 Ari, since you're contributing nontrivial changes, would you do that, too? Both of you, please let me know when/if you start the process. From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 28 19:54:22 2011 Received: (at 8565) by debbugs.gnu.org; 28 Apr 2011 23:54:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFb2L-0007YS-S3 for submit@debbugs.gnu.org; Thu, 28 Apr 2011 19:54:22 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1QFb2J-0007YH-QC for 8565@debbugs.gnu.org; Thu, 28 Apr 2011 19:54:20 -0400 Received: (qmail 83424 invoked from network); 28 Apr 2011 23:54:14 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 28 Apr 2011 23:54:14 -0000 Message-ID: <4DB9FD7D.7010507@draigBrady.com> Date: Fri, 29 Apr 2011 00:51:25 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Jim Meyering Subject: Re: bug#8565: gzip/bzip2/output-hook support for split References: <87zknb30h7.fsf@rho.meyering.net> In-Reply-To: <87zknb30h7.fsf@rho.meyering.net> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 8565 Cc: 8565@debbugs.gnu.org, Ari Pollak , sudhach@chandrasudha.net, kwzh@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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: -2.7 (--) On 27/04/11 21:25, Jim Meyering wrote: > Ari Pollak wrote: >> I've been sitting on this for a few months expecting to finish it, but >> still haven't found the time, so I'm just putting it out there now so >> it isn't lost entirely. It's originally from Chandrakumar Muthaiah: >> http://article.gmane.org/gmane.comp.gnu.coreutils.bugs/15684 >> I applied it to the latest git, added some tests, and cleaned it up a bit. > > Thank you for working on that. > However, we still don't have a copyright assignment > from Chandrakumar Muthaiah. Chandrakumar, have you > started the process? > > http://git.sv.gnu.org/cgit/coreutils.git/tree/HACKING#n429 > > Ari, since you're contributing nontrivial > changes, would you do that, too? > > Both of you, please let me know when/if you start the process. There is also Karl's variant, and he already has assigned copyright http://lists.gnu.org/archive/html/coreutils/2011-01/msg00023.html cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 29 04:37:31 2011 Received: (at 8565) by debbugs.gnu.org; 29 Apr 2011 08:37:33 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFjCc-0002EX-5n for submit@debbugs.gnu.org; Fri, 29 Apr 2011 04:37:31 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFjCZ-0002EJ-0a for 8565@debbugs.gnu.org; Fri, 29 Apr 2011 04:37:28 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 3415960098; Fri, 29 Apr 2011 10:37:21 +0200 (CEST) From: Jim Meyering To: Karl Heuer Subject: Re: bug#8565: gzip/bzip2/output-hook support for split In-Reply-To: <4DB9FD7D.7010507@draigBrady.com> (=?iso-8859-1?Q?=22P=E1drai?= =?iso-8859-1?Q?g?= Brady"'s message of "Fri, 29 Apr 2011 00:51:25 +0100") References: <87zknb30h7.fsf@rho.meyering.net> <4DB9FD7D.7010507@draigBrady.com> Date: Fri, 29 Apr 2011 10:37:20 +0200 Message-ID: <87sjt1v4fz.fsf@rho.meyering.net> Lines: 30 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8565 Cc: 8565@debbugs.gnu.org, Ari Pollak , sudhach@chandrasudha.net, =?iso-8859-1?Q?P=E1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (------) P=E1draig Brady wrote: > On 27/04/11 21:25, Jim Meyering wrote: >> Ari Pollak wrote: >>> I've been sitting on this for a few months expecting to finish it, but >>> still haven't found the time, so I'm just putting it out there now so >>> it isn't lost entirely. It's originally from Chandrakumar Muthaiah: >>> http://article.gmane.org/gmane.comp.gnu.coreutils.bugs/15684 >>> I applied it to the latest git, added some tests, and cleaned it up a b= it. >> >> Thank you for working on that. >> However, we still don't have a copyright assignment >> from Chandrakumar Muthaiah. Chandrakumar, have you >> started the process? >> >> http://git.sv.gnu.org/cgit/coreutils.git/tree/HACKING#n429 >> >> Ari, since you're contributing nontrivial >> changes, would you do that, too? >> >> Both of you, please let me know when/if you start the process. > > There is also Karl's variant, and he already has assigned copyright > http://lists.gnu.org/archive/html/coreutils/2011-01/msg00023.html Thanks for the reminder, P=E1draig. Karl's is more general. It's just as well: I haven't heard from Chandrakumar. Karl, this is a good time to add the feature. If you don't have time to handle the remaining bits (test, doc and NEWS), let us know and we will take care of the rest. From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 29 06:34:02 2011 Received: (at 8565) by debbugs.gnu.org; 29 Apr 2011 10:34:02 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFl1N-0004qX-Uw for submit@debbugs.gnu.org; Fri, 29 Apr 2011 06:34:02 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFl1L-0004qK-7k for 8565@debbugs.gnu.org; Fri, 29 Apr 2011 06:34:00 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 7563B60110; Fri, 29 Apr 2011 12:33:53 +0200 (CEST) From: Jim Meyering To: kwzh@gnu.org (Karl Heuer) Subject: Re: bug#8565: gzip/bzip2/output-hook support for split In-Reply-To: (Karl Heuer's message of "Fri, 29 Apr 2011 05:26:14 -0400") References: Date: Fri, 29 Apr 2011 12:33:53 +0200 Message-ID: <87r58ltkha.fsf@rho.meyering.net> Lines: 85 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8565 Cc: 8565@debbugs.gnu.org, Ari Pollak , sudhach@chandrasudha.net, =?iso-8859-1?Q?P=E1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (------) Karl Heuer wrote: >>Karl, this is a good time to add the feature. >>If you don't have time to handle the remaining bits (test, >>doc and NEWS), let us know and we will take care of the rest. > > I'd better let you do it; I've got too many other items in my > queue at the moment. Ok. For starters, I'm squashing this onto your patch. The type change is required to get past this compilation error: split.c: In function 'create': split.c:334:42: error: passing argument 2 of 'x2nrealloc' from incompatible pointer type [-Werror] ../lib/xalloc.h:191:1: note: expected 'size_t *' but argument is of type 'int *' cc1: all warnings being treated as errors Also, at least initially, I'll remove the short-named (-f) version of your new --filter option, just to be on the safe side. People can always abbreviate using "--f". >From 6b72fcbf896e082cc797b601c0f4e2533a479981 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 29 Apr 2011 12:26:50 +0200 Subject: [PATCH] split: minor adjustments: s/int/size_t/ for new globals, and... rename: open_pipes_size -> open_pipes_alloc and open_pipes_len -> n_open_pipes --- src/split.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/split.c b/src/split.c index c977ceb..2b9cdfc 100644 --- a/src/split.c +++ b/src/split.c @@ -56,8 +56,8 @@ static int filter_pid; /* Array of open pipes. */ static int *open_pipes; -static int open_pipes_size; -static int open_pipes_len; +static size_t open_pipes_alloc; +static size_t n_open_pipes; /* Blocked signals. */ static sigset_t oldblocked; @@ -307,7 +307,7 @@ create (const char* name) earlier call, otherwise this process will be holding a write-pipe that will prevent the earlier process from reading an EOF on the corresponding read-pipe. */ - for (j = 0; j < open_pipes_len; ++j) + for (j = 0; j < n_open_pipes; ++j) if (close (open_pipes[j]) != 0) error (EXIT_FAILURE, errno, _("closing prior pipe")); if (close (fd_pair[1])) @@ -329,10 +329,10 @@ create (const char* name) if (close (fd_pair[0]) != 0) error (EXIT_FAILURE, errno, _("closing input pipe")); filter_pid = child_pid; - if (open_pipes_len == open_pipes_size) - open_pipes = (int *) x2nrealloc (open_pipes, &open_pipes_size, + if (n_open_pipes == open_pipes_alloc) + open_pipes = (int *) x2nrealloc (open_pipes, &open_pipes_alloc, sizeof *open_pipes); - open_pipes[open_pipes_len++] = fd_pair[1]; + open_pipes[n_open_pipes++] = fd_pair[1]; return fd_pair[1]; } } @@ -350,9 +350,9 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name) if (fp == NULL && close (fd) < 0) error (EXIT_FAILURE, errno, "%s", name); int j; - for (j = 0; j < open_pipes_len; ++j) + for (j = 0; j < n_open_pipes; ++j) if (open_pipes[j] == fd) { - open_pipes[j] = open_pipes[--open_pipes_len]; + open_pipes[j] = open_pipes[--n_open_pipes]; break; } } -- 1.7.5.452.gcf2d0 From debbugs-submit-bounces@debbugs.gnu.org Fri Apr 29 07:39:20 2011 Received: (at 8565) by debbugs.gnu.org; 29 Apr 2011 11:39:21 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFm2a-00076U-54 for submit@debbugs.gnu.org; Fri, 29 Apr 2011 07:39:20 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QFjxt-0003JJ-7v for 8565@debbugs.gnu.org; Fri, 29 Apr 2011 05:26:22 -0400 Received: from kwzh by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1QFjxm-0003ai-Ag; Fri, 29 Apr 2011 05:26:14 -0400 Date: Fri, 29 Apr 2011 05:26:14 -0400 Message-Id: From: kwzh@gnu.org (Karl Heuer) To: Jim Meyering Subject: Re: bug#8565: gzip/bzip2/output-hook support for split MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: 8565 X-Mailman-Approved-At: Fri, 29 Apr 2011 07:39:19 -0400 Cc: 8565@debbugs.gnu.org, Ari Pollak , sudhach@chandrasudha.net, Pádraig Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.6 (------) >Karl, this is a good time to add the feature. >If you don't have time to handle the remaining bits (test, >doc and NEWS), let us know and we will take care of the rest. I'd better let you do it; I've got too many other items in my queue at the moment. From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 30 10:29:54 2011 Received: (at 8565) by debbugs.gnu.org; 30 Apr 2011 14:29:55 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QGBBC-0003PV-1s for submit@debbugs.gnu.org; Sat, 30 Apr 2011 10:29:54 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QGBB9-0003PI-AE for 8565@debbugs.gnu.org; Sat, 30 Apr 2011 10:29:52 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 8D57360391; Sat, 30 Apr 2011 16:29:45 +0200 (CEST) From: Jim Meyering To: kwzh@gnu.org (Karl Heuer) Subject: Re: bug#8565: gzip/bzip2/output-hook support for split In-Reply-To: (Karl Heuer's message of "Fri, 29 Apr 2011 05:26:14 -0400") References: Date: Sat, 30 Apr 2011 16:29:45 +0200 Message-ID: <87zkn7lsme.fsf@rho.meyering.net> Lines: 155 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8565 Cc: 8565@debbugs.gnu.org, Ari Pollak , sudhach@chandrasudha.net, =?iso-8859-1?Q?P=E1draig?= Brady X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (------) Karl Heuer wrote: >>Karl, this is a good time to add the feature. >>If you don't have time to handle the remaining bits (test, >>doc and NEWS), let us know and we will take care of the rest. > > I'd better let you do it; I've got too many other items in my > queue at the moment. Hi Karl, FYI, I've nearly finished with split-filter-related changes. I posted a slightly modified version of your patch and a few follow-on changes: http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1138 And one more below. I noticed that you've added a lot of "errno != EPIPE" tests. And for a good reason, as you explained here: /* When filtering, closure of one pipe must not terminate the process, as there may still be other streams expecting input from us. */ sigemptyset (&newblocked); if (filter_command) { struct sigaction act; sigaction (SIGPIPE, NULL, &act); if (act.sa_handler != SIG_IGN) sigaddset (&newblocked, SIGPIPE); } sigprocmask (SIG_BLOCK, &newblocked, &oldblocked); However, I presume you intended that change only when filter_command is non-NULL. I would not want to suppress an error if somehow I accidentally ran a classic split command with a non-default signal handler and I sent it a SIGPIPE signal just as it was writing to a file I cared about. >From baf68e2dfb8ccfbfa797917e818551b12e129aef Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 30 Apr 2011 16:08:04 +0200 Subject: [PATCH] split: factor out all new EPIPE tests; exempt EPIPE only with --filter * src/split.c (ignorable): New function, to encapsulate EPIPE test. Ignore failure with errno == EPIPE only when --filter=CMD is specified. Replace all comparisons like && errno != EPIPE with && ! ignorable (errno). --- src/split.c | 28 ++++++++++++++++++---------- 1 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/split.c b/src/split.c index 66f44fc..05315e6 100644 --- a/src/split.c +++ b/src/split.c @@ -131,6 +131,13 @@ static struct option const longopts[] = {NULL, 0, NULL, 0} }; +/* Return true if the errno value, ERR, is ignorable. */ +static inline bool +ignorable (int err) +{ + return filter_command && err == EPIPE; +} + static void set_suffix_length (uintmax_t n_units, enum Split_type split_type) { @@ -346,7 +353,7 @@ create (const char *name) static void closeout (FILE *fp, int fd, pid_t pid, char const *name) { - if (fp != NULL && fclose (fp) != 0 && errno != EPIPE) + if (fp != NULL && fclose (fp) != 0 && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", name); if (fd >= 0) { @@ -412,7 +419,7 @@ cwrite (bool new_file_flag, const char *bp, size_t bytes) if ((output_desc = create (outfile)) < 0) error (EXIT_FAILURE, errno, "%s", outfile); } - if (full_write (output_desc, bp, bytes) != bytes && errno != EPIPE) + if (full_write (output_desc, bp, bytes) != bytes && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", outfile); } @@ -635,7 +642,7 @@ lines_chunk_split (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, large chunks from an existing file, so it's more efficient to write out directly. */ if (full_write (STDOUT_FILENO, bp, to_write) != to_write - && errno != EPIPE) + && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", _("write error")); } else @@ -698,7 +705,8 @@ bytes_chunk_extract (uintmax_t k, uintmax_t n, char *buf, size_t bufsize, error (EXIT_FAILURE, errno, "%s", infile); else if (n_read == 0) break; /* eof. */ - if (full_write (STDOUT_FILENO, buf, n_read) != n_read && errno != EPIPE) + if (full_write (STDOUT_FILENO, buf, n_read) != n_read + && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", quote ("-")); start += n_read; } @@ -772,7 +780,7 @@ ofile_open (of_t *files, size_t i_check, size_t nfiles) error (EXIT_FAILURE, errno, "%s", files[i_check].of_name); } - if (fclose (files[i_reopen].ofile) != 0 && errno != EPIPE) + if (fclose (files[i_reopen].ofile) != 0 && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", files[i_reopen].of_name); files[i_reopen].ofile = NULL; files[i_reopen].ofd = OFD_APPEND; @@ -856,11 +864,11 @@ lines_rr (uintmax_t k, uintmax_t n, char *buf, size_t bufsize) if (line_no == k && unbuffered) { if (full_write (STDOUT_FILENO, bp, to_write) != to_write - && errno != EPIPE) + && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", _("write error")); } else if (line_no == k && fwrite (bp, to_write, 1, stdout) != 1 - && errno != EPIPE) + && ! ignorable (errno)) { clearerr (stdout); /* To silence close_stdout(). */ error (EXIT_FAILURE, errno, "%s", _("write error")); @@ -877,15 +885,15 @@ lines_rr (uintmax_t k, uintmax_t n, char *buf, size_t bufsize) /* Note writing to fd, rather than flushing the FILE gives an 8% performance benefit, due to reduced data copying. */ if (full_write (files[i_file].ofd, bp, to_write) != to_write - && errno != EPIPE) + && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", files[i_file].of_name); } else if (fwrite (bp, to_write, 1, files[i_file].ofile) != 1 - && errno != EPIPE) + && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", files[i_file].of_name); if (file_limit) { - if (fclose (files[i_file].ofile) != 0 && errno != EPIPE) + if (fclose (files[i_file].ofile) != 0 && ! ignorable (errno)) error (EXIT_FAILURE, errno, "%s", files[i_file].of_name); files[i_file].ofile = NULL; files[i_file].ofd = OFD_APPEND; -- 1.7.5.134.g1c08b From debbugs-submit-bounces@debbugs.gnu.org Tue May 31 04:06:45 2011 Received: (at 8565) by debbugs.gnu.org; 31 May 2011 08:06:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QRJyO-0007V6-QR for submit@debbugs.gnu.org; Tue, 31 May 2011 04:06:45 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QRJyN-0007Uu-AN for 8565@debbugs.gnu.org; Tue, 31 May 2011 04:06:43 -0400 Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id BF40C6003D; Tue, 31 May 2011 10:06:37 +0200 (CEST) From: Jim Meyering To: Ari Pollak Subject: Re: bug#8565: gzip/bzip2/output-hook support for split In-Reply-To: (Ari Pollak's message of "Wed, 27 Apr 2011 00:30:41 -0400") References: Date: Tue, 31 May 2011 10:06:37 +0200 Message-ID: <87aae3jnua.fsf@rho.meyering.net> Lines: 13 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.0 (------) X-Debbugs-Envelope-To: 8565 Cc: 8565@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.0 (------) tags 8565 notabug close 8565 thanks Ari Pollak wrote: > I've been sitting on this for a few months expecting to finish it, but > still haven't found the time, so I'm just putting it out there now so > it isn't lost entirely. It's originally from Chandrakumar Muthaiah: > http://article.gmane.org/gmane.comp.gnu.coreutils.bugs/15684 > I applied it to the latest git, added some tests, and cleaned it up a bit. As you may have seen, split now supports the --filter=COMMAND option, so I'm closing this issue. Thanks! From debbugs-submit-bounces@debbugs.gnu.org Sun Jul 24 10:13:26 2011 Received: (at control) by debbugs.gnu.org; 24 Jul 2011 14:13:27 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QkzQs-0005OB-8J for submit@debbugs.gnu.org; Sun, 24 Jul 2011 10:13:26 -0400 Received: from mx.meyering.net ([82.230.74.64]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QkzQh-0005Nr-Gv for control@debbugs.gnu.org; Sun, 24 Jul 2011 10:13:20 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id B18DC6009F for ; Sun, 24 Jul 2011 16:13:09 +0200 (CEST) From: Jim Meyering To: control@debbugs.gnu.org Subject: close it for real, this time Date: Sun, 24 Jul 2011 16:13:09 +0200 Message-ID: <8762mrahsa.fsf@rho.meyering.net> Lines: 2 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.1 (------) close 8565 thanks From unknown Sat Jun 14 03:49:31 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 22 Aug 2011 11:24:04 +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