From unknown Sun Jun 22 04:22:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Resent-From: Bjartur Thorlacius Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 23 Feb 2011 19:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8102@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.129848915631050 (code B ref -1); Wed, 23 Feb 2011 19:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Feb 2011 19:25:56 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PsKLT-00084k-W8 for submit@debbugs.gnu.org; Wed, 23 Feb 2011 14:25:56 -0500 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PsJur-00078E-BE for submit@debbugs.gnu.org; Wed, 23 Feb 2011 13:58:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsJul-0000M7-L4 for submit@debbugs.gnu.org; Wed, 23 Feb 2011 13:58:20 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_TO_NO_BRKTS_FREEMAIL autolearn=no version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:43040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsJul-0000M3-JE for submit@debbugs.gnu.org; Wed, 23 Feb 2011 13:58:19 -0500 Received: from [140.186.70.92] (port=60837 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsJuk-0005fH-Fa for bug-coreutils@gnu.org; Wed, 23 Feb 2011 13:58:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsJuj-0000LS-HB for bug-coreutils@gnu.org; Wed, 23 Feb 2011 13:58:18 -0500 Received: from mail-iw0-f169.google.com ([209.85.214.169]:36707) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsJuj-0000LH-Cu for bug-coreutils@gnu.org; Wed, 23 Feb 2011 13:58:17 -0500 Received: by iwl42 with SMTP id 42so5301706iwl.0 for ; Wed, 23 Feb 2011 10:58:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=9KfeAt3NbADVkqh3dfsRofpQ6bDJfu6Js0KTLLlqriM=; b=U8KPK/gJrvh9fK9XRTmpnpU3+sHDHXqrmZ1nJ3QNAiDl0S66bU/z32JKmBZRAtg9BU VQQwJBjijvOUmJ2FcfH26nvy/QLktVscqWqgzPpjnCv73ZomYYtjLSZcnwnA1Lk/WHMs fQEmkzdoybhKskX4HPeEwq6kJQFfn4sCmGmoo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=U6Why0bwtVJ49Ag7FeRH+HVCIaWX2ASLn5+zBCxxHtUDRYucyG+wAsfhaupCqyI2wC vmxLw9LdJQxHlXLB1PAjJHox74MBJeVRlPBbfANI43jSV7SCJ0JbLEcmbeJdRr9mXpHj vW5FtVWaIc2AOdkNqpjzXN/WQYQlILcxmNDdE= MIME-Version: 1.0 Received: by 10.231.36.68 with SMTP id s4mr3414487ibd.178.1298487496356; Wed, 23 Feb 2011 10:58:16 -0800 (PST) Received: by 10.231.192.10 with HTTP; Wed, 23 Feb 2011 10:58:16 -0800 (PST) Date: Wed, 23 Feb 2011 18:58:16 +0000 Message-ID: From: Bjartur Thorlacius Content-Type: text/plain; charset=UTF-8 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, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -5.9 (-----) X-Mailman-Approved-At: Wed, 23 Feb 2011 14:25:54 -0500 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 (-----) % echo | head -n2 && echo bug bug This bit me when writing a line oriented prompter (which would `while head -n1`). FYI, this also applies to FreeBSD head. From unknown Sun Jun 22 04:22:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 23 Feb 2011 20:17:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bjartur Thorlacius Cc: 8102@debbugs.gnu.org Received: via spool by 8102-submit@debbugs.gnu.org id=B8102.12984921715822 (code B ref 8102); Wed, 23 Feb 2011 20:17:01 +0000 Received: (at 8102) by debbugs.gnu.org; 23 Feb 2011 20:16:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PsL86-0001Vr-P9 for submit@debbugs.gnu.org; Wed, 23 Feb 2011 15:16:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PsL82-0001VP-VZ for 8102@debbugs.gnu.org; Wed, 23 Feb 2011 15:16:08 -0500 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 p1NKG15x030006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 23 Feb 2011 15:16:01 -0500 Received: from [10.3.113.92] (ovpn-113-92.phx2.redhat.com [10.3.113.92]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1NKG0R9023384; Wed, 23 Feb 2011 15:16:00 -0500 Message-ID: <4D656B00.4020906@redhat.com> Date: Wed, 23 Feb 2011 13:16:00 -0700 From: Eric Blake Organization: Red Hat User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 References: In-Reply-To: X-Enigmail-Version: 1.1.2 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enig7590A4478FA1BCCD829F6A64" X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-Spam-Score: -10.2 (----------) 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: -10.2 (----------) This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7590A4478FA1BCCD829F6A64 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02/23/2011 11:58 AM, Bjartur Thorlacius wrote: > % echo | head -n2 && echo bug > bug >=20 > This bit me when writing a line oriented prompter (which would `while > head -n1`). >=20 > FYI, this also applies to FreeBSD head. That's because this is not a bug, but a POSIX requirement: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html "When a file contains less than number lines, it shall be copied to standard output in its entirety. This shall not be an error." --=20 Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org --------------enig7590A4478FA1BCCD829F6A64 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.11 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/ iQEcBAEBCAAGBQJNZWsAAAoJEKeha0olJ0NqIYwH/3VEiWODrdkNKTQIkceo4twe RYeKcmhZLWs+q6nYthXHv/9Fp/gtu4B91H+M+U93l0CnYapOQRMR3B3VL6dYejXh 8R9foQep35iRNvcdEFpJDas6mGdTEc69SFZiO2ePNfLjJjMM/eTm2zrgm6Yq4Kcd EUVIZqM1qibxfk2IrE5bmY81PykSt5hVZf2+rtl1lVujRjemn7NP6rwOnFTWQrwE KApOno8Vk/t18OrekQs73AaqOv00PzJ/KzR7/Zn23nROuQvG6beBY/lwz53HlFto AFwOwxYMoO6vTnIFLGoUScfE7CXKqflgQkhnzqkEvxhWQtEzcKBKEW0qb2r7qak= =1h5j -----END PGP SIGNATURE----- --------------enig7590A4478FA1BCCD829F6A64-- From unknown Sun Jun 22 04:22:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Resent-From: Bjartur Thorlacius Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 25 Feb 2011 16:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 8102@debbugs.gnu.org Received: via spool by 8102-submit@debbugs.gnu.org id=B8102.129865202023077 (code B ref 8102); Fri, 25 Feb 2011 16:41:01 +0000 Received: (at 8102) by debbugs.gnu.org; 25 Feb 2011 16:40:20 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt0iJ-000609-Jy for submit@debbugs.gnu.org; Fri, 25 Feb 2011 11:40:19 -0500 Received: from mail-vx0-f172.google.com ([209.85.220.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt0iH-0005zw-C4 for 8102@debbugs.gnu.org; Fri, 25 Feb 2011 11:40:18 -0500 Received: by vxg33 with SMTP id 33so1344031vxg.3 for <8102@debbugs.gnu.org>; Fri, 25 Feb 2011 08:40:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=hACbvfT3bRfIQxEpyxFIL5W1YcnlvEqxSnw4LehwC4Y=; b=C2kcI87rNRH6510o+l1fCWKudLD27S36d15BzzwbsjLqAw4F25DJZNUA1q/1+5V6GW RLQDiAkpS2ZDmEedJmdUOBEpp7OpvFZheGXR1kpas51T2FVmnCGODvn8KDYnptG1vr8K 878vBK+HP36voOfsyQptWOzarHidl04fwgtHA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=K2ITCuatPNHkQvdTtcRSOG01NwglYgyIJlRTjlAxX0A+/0py7H3c3z5MKYoF7SixGO wx0zBiOe40hzPPTDMHE93xKAVWARhvUGriFEhxx82Wtv/jwDRyyU3Mm+OJK5xwo9TZXJ Zj2f/L8/kTVFkB9JGe1guxwlno3nWQea5DD/Y= MIME-Version: 1.0 Received: by 10.52.163.36 with SMTP id yf4mr4499083vdb.12.1298652011671; Fri, 25 Feb 2011 08:40:11 -0800 (PST) Received: by 10.52.162.70 with HTTP; Fri, 25 Feb 2011 08:40:11 -0800 (PST) In-Reply-To: <4D656B00.4020906@redhat.com> References: <4D656B00.4020906@redhat.com> Date: Fri, 25 Feb 2011 16:40:11 +0000 Message-ID: From: Bjartur Thorlacius Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.9 (---) 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: -3.7 (---) On 2/23/11, Eric Blake wrote: > On 02/23/2011 11:58 AM, Bjartur Thorlacius wrote: > That's because this is not a bug, but a POSIX requirement: > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html > > "When a file contains less than number lines, it shall be copied to > standard output in its entirety. This shall not be an error." > Indeed. Since it's explicitly mentioned, I assume there's a reason for it. I'd be grateful if someone could point out what the rationale beind the decision is (or better yet, where such information can be found). So should I be using a head-alike for iterating over lines, and would such an utility belong to a GNU package, or is awk the right tool for the job? From unknown Sun Jun 22 04:22:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF References: Resent-From: "Alan Curry" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 25 Feb 2011 21:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: svartman95@gmail.com (Bjartur Thorlacius) Cc: 8102@debbugs.gnu.org Received: via spool by 8102-submit@debbugs.gnu.org id=B8102.129867099821252 (code B ref 8102); Fri, 25 Feb 2011 21:57:02 +0000 Received: (at 8102) by debbugs.gnu.org; 25 Feb 2011 21:56:38 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt5eP-0005Wj-GX for submit@debbugs.gnu.org; Fri, 25 Feb 2011 16:56:37 -0500 Received: from c-67-162-90-113.hsd1.in.comcast.net ([67.162.90.113] helo=kosh.dhis.org) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1Pt5eN-0005WX-0K for 8102@debbugs.gnu.org; Fri, 25 Feb 2011 16:56:35 -0500 Received: (qmail 17384 invoked by uid 1000); 25 Feb 2011 21:56:28 -0000 Message-ID: <20110225215628.17383.qmail@kosh.dhis.org> From: "Alan Curry" Date: Fri, 25 Feb 2011 16:56:28 -0500 (GMT+5) In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Score: -0.6 (/) 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: -0.6 (/) Bjartur Thorlacius writes: > > On 2/23/11, Eric Blake wrote: > > On 02/23/2011 11:58 AM, Bjartur Thorlacius wrote: > > That's because this is not a bug, but a POSIX requirement: > > > > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/head.html > > > > "When a file contains less than number lines, it shall be copied to > > standard output in its entirety. This shall not be an error." > > > Indeed. Since it's explicitly mentioned, I assume there's a reason for > it. I'd be grateful if someone could point out what the rationale beind > the decision is (or better yet, where such information can be found). > > So should I be using a head-alike for iterating over lines, and would > such an utility belong to a GNU package, or is awk the right tool for the > job? Here's what an iterate-over-lines loop normally looks like in a shell script: while read -r line do something $line done The idea of using head to control a loop means you are either a newbie who didn't know about "read", or you are trying to do something subtly different which I didn't understand. Excuse me if I guessed the wrong one. -- Alan Curry From unknown Sun Jun 22 04:22:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 25 Feb 2011 22:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Bjartur Thorlacius Cc: 8102@debbugs.gnu.org Received: via spool by 8102-submit@debbugs.gnu.org id=B8102.129867262123644 (code B ref 8102); Fri, 25 Feb 2011 22:24:01 +0000 Received: (at 8102) by debbugs.gnu.org; 25 Feb 2011 22:23:41 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt64a-00069I-Kk for submit@debbugs.gnu.org; Fri, 25 Feb 2011 17:23:40 -0500 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt64Y-000693-JC; Fri, 25 Feb 2011 17:23:39 -0500 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 76CA821308; Fri, 25 Feb 2011 15:23:32 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id 67EF52DC3B; Fri, 25 Feb 2011 15:23:32 -0700 (MST) Date: Fri, 25 Feb 2011 15:23:32 -0700 From: Bob Proulx Message-ID: <20110225222332.GA1550@hysteria.proulx.com> References: <4D656B00.4020906@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam-Score: -2.4 (--) 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.4 (--) tags 8102 + notabug thanks Bjartur Thorlacius wrote: > Indeed. Since it's explicitly mentioned, I assume there's a reason for > it. I'd be grateful if someone could point out what the rationale beind > the decision is (or better yet, where such information can be found). Mostly because that is how the tool has always behaved since the first implementation of the program. Because BSD, System V, GNU (and HP-UX, IBM AIX, SunOS/Solaris, many others) all implemented it the same way it was standardized that way for POSIX so that future implementations would be the same and not break backward compatibility with the previously existing implementations. After something has been that way for twenty plus years there often isn't a particular reason other than if you change it then you break twenty years worth of scripting that expects it. For many of these the tool came first and then people documented the existing behavior. The equivalent to head has always been sed. All of these print the first five lines of a file: head -n5 sed -n 1,5p sed 5q None of those require five lines or exit with an error code. Personally I have never thought about that possibility nor needed it. > So should I be using a head-alike for iterating over lines, and > would such an utility belong to a GNU package, or is awk the right > tool for the job? What are you trying to do? Bob From unknown Sun Jun 22 04:22:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Resent-From: Bjartur Thorlacius Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Fri, 25 Feb 2011 23:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Bob Proulx Cc: 8102@debbugs.gnu.org Received: via spool by 8102-submit@debbugs.gnu.org id=B8102.12986772393638 (code B ref 8102); Fri, 25 Feb 2011 23:41:01 +0000 Received: (at 8102) by debbugs.gnu.org; 25 Feb 2011 23:40:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt7H3-0000wc-Ul for submit@debbugs.gnu.org; Fri, 25 Feb 2011 18:40:38 -0500 Received: from mail-vx0-f172.google.com ([209.85.220.172]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Pt7H1-0000wQ-EG for 8102@debbugs.gnu.org; Fri, 25 Feb 2011 18:40:35 -0500 Received: by vxg33 with SMTP id 33so1643975vxg.3 for <8102@debbugs.gnu.org>; Fri, 25 Feb 2011 15:40:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=ziB44tfvIW+bJt8xnOhKVvs3F/M8UrI62vfE7unfxFY=; b=MGBBSN42p1ZGxD19neRh3cz2LSOe/hiGn+DYKieaRYz+BKzujfH2w1ExqPEgZohSP9 5IOHwQLzZefEvPDV9oWMluxsUfh22q9q630BsVNcqgjT/d/vaoAX4Bjxhy71wXTG8mTg KJ3HhRkIWR+rrivq92f6axNcB58V55rzaeykk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=XhrFSxWLp4ZBMkJazAGg4+EUX8hjPB6ozPDO3XR4Bhs4ah49wqKpXKwmS8n24OGdOE JVvR3GrnTCpZJ2lFihbgmC51EvzcWapMs39e3Wm1gwp+Eu6oPm/BP+VbtUL1UYWzUyg8 E787r/BBSMb1N4UYwHl9aaMi/s5ZdUucj3VkQ= MIME-Version: 1.0 Received: by 10.52.163.36 with SMTP id yf4mr5231481vdb.12.1298677229920; Fri, 25 Feb 2011 15:40:29 -0800 (PST) Received: by 10.52.162.70 with HTTP; Fri, 25 Feb 2011 15:40:29 -0800 (PST) In-Reply-To: <20110225222332.GA1550@hysteria.proulx.com> References: <4D656B00.4020906@redhat.com> <20110225222332.GA1550@hysteria.proulx.com> Date: Fri, 25 Feb 2011 23:40:29 +0000 Message-ID: From: Bjartur Thorlacius Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -3.4 (---) 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: -3.3 (---) On 2/25/11, Bob Proulx wrote: > Personally I have never thought about that possibility nor needed it. > >> So should I be using a head-alike for iterating over lines, and >> would such an utility belong to a GNU package, or is awk the right >> tool for the job? > > What are you trying to do? > Something along the lines of: % cat bin/prompt while head -n1 >/dev/tty do head -n1 Some variable < some value > Another variable < another value output value unit where shell commands are prefixed with '% ', output written to /dev/tty with '> ' and input read from /dev/tty with '< '. Output written to stdout and not redirected by the shell is not prefixed. Although the end of prompt/pkg is reached every time a user inputs a line after the first `wc -l Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 28 Feb 2011 06:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8102 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Bjartur Thorlacius , Bob Proulx Cc: "8102@debbugs.gnu.org" <8102@debbugs.gnu.org> Received: via spool by 8102-submit@debbugs.gnu.org id=B8102.12988763244453 (code B ref 8102); Mon, 28 Feb 2011 06:59:02 +0000 Received: (at 8102) by debbugs.gnu.org; 28 Feb 2011 06:58:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ptx48-00019m-8V for submit@debbugs.gnu.org; Mon, 28 Feb 2011 01:58:44 -0500 Received: from m0019.fra.mmp.de.bt.com ([62.180.227.30] helo=ms01.m0019.fra.mmp.de.bt.com) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ptx46-00019Z-MQ for 8102@debbugs.gnu.org; Mon, 28 Feb 2011 01:58:43 -0500 Received: from senmx11-mx ([62.134.46.9] [62.134.46.9]) by ms01.m0020.fra.mmp.de.bt.com with ESMTP id BT-MMP-3561852; Mon, 28 Feb 2011 07:58:36 +0100 Received: from MCHP063A.global-ad.net (unknown [172.29.37.61]) by senmx11-mx (Server) with ESMTP id 1DBDC1EB82AE; Mon, 28 Feb 2011 07:58:36 +0100 (CET) Received: from MCHP058A.global-ad.net ([172.29.37.55]) by MCHP063A.global-ad.net ([172.29.37.61]) with mapi; Mon, 28 Feb 2011 07:58:36 +0100 From: "Voelker, Bernhard" Date: Mon, 28 Feb 2011 07:58:32 +0100 Thread-Topic: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Thread-Index: AcvVSRye4bLWPI1LQa+MAmHqiDfNGABy2QMg Message-ID: <7856072A9D04C24B82DFE2B1112FE38A06B86F1B7A@MCHP058A.global-ad.net> References: <4D656B00.4020906@redhat.com> <20110225222332.GA1550@hysteria.proulx.com> In-Reply-To: Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: de-DE, en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Spam-Score: -2.5 (--) 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.5 (--) Bjartur Thorlacius wrote: > The only way I can imagine scripts braking due to head returning > non-zero upon premature EOF are scripts that consider every non-zero > exit fatal, but don't know many lines their input is. How many can > they be? well, head also returns !=3D0 e.g. if the file doesn't exist. Therefore, if a script relies on this, it would fail in the future if head's behaviour was changed. Have a nice day, Berny From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 30 09:42:03 2011 Received: (at control) by debbugs.gnu.org; 30 Oct 2011 13:42:03 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RKVeE-0002Xs-Lc for submit@debbugs.gnu.org; Sun, 30 Oct 2011 09:42:02 -0400 Received: from mx.meyering.net ([88.168.87.75]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RKVeC-0002XU-DO for control@debbugs.gnu.org; Sun, 30 Oct 2011 09:42:00 -0400 Received: from rho.meyering.net (localhost.localdomain [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 147156007E for ; Sun, 30 Oct 2011 14:39:54 +0100 (CET) From: Jim Meyering To: control@debbugs.gnu.org Subject: Re: bug#8102: [head] do not return EXIT_SUCCESS upon premature EOF Date: Sun, 30 Oct 2011 14:39:53 +0100 Message-ID: <87lis2k386.fsf@rho.meyering.net> Lines: 3 MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.7 (--) 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: -2.7 (--) tags 8102 + notabug close 8102 thanks