From unknown Fri Jun 20 20:09:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16561: Bug report for 'head' (and 'wc' et. al.) Resent-From: LGUC Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Sun, 26 Jan 2014 19:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16561 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 16561@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13907652161640 (code B ref -1); Sun, 26 Jan 2014 19:41:03 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jan 2014 19:40:16 +0000 Received: from localhost ([127.0.0.1]:36897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7VZ1-0000QH-FZ for submit@debbugs.gnu.org; Sun, 26 Jan 2014 14:40:15 -0500 Received: from eggs.gnu.org ([208.118.235.92]:33363) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7RKT-0000eg-H8 for submit@debbugs.gnu.org; Sun, 26 Jan 2014 10:08:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7RKK-0002Qt-Sh for submit@debbugs.gnu.org; Sun, 26 Jan 2014 10:08:57 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,MIME_HTML_ONLY,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:44253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7RKK-0002Qp-PS for submit@debbugs.gnu.org; Sun, 26 Jan 2014 10:08:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7RKC-0001QY-9I for bug-coreutils@gnu.org; Sun, 26 Jan 2014 10:08:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7RK3-0002PU-Sf for bug-coreutils@gnu.org; Sun, 26 Jan 2014 10:08:40 -0500 Received: from mail-ve0-x22a.google.com ([2607:f8b0:400c:c01::22a]:60767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7RK3-0002PO-NM for bug-coreutils@gnu.org; Sun, 26 Jan 2014 10:08:31 -0500 Received: by mail-ve0-f170.google.com with SMTP id cz12so3004049veb.29 for ; Sun, 26 Jan 2014 07:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:disposition-notification-to:date:to:from:subject :mime-version:content-type; bh=r+a2vlc7TDJ5rjzhXb887omIrCx9+3xHuPdOr/ImWuw=; b=x/enHQYUiGqyWOpo+Uc80xc29RbNw3xgI9QvFj2PwEpikliX2LrKOWWrjHXCNmLuLy jxV+bJHlyYUPj4O4kOS0S/xxCzjPkYruqaIbl4+geQ8riHXX1VDMT1lBcsFOfjszYwN1 FjZK1IOvHVpXbWUu8ukncjd1p+YangrCqsff9OwjygoZ5kcEyg5nIElCZ9c7jDXcCb7k KMtN2904D0hxTdc6IwSvQNvzlkjg8Bt58JRHucP+XIW590nhuVaKCxgN6yDMXd4QDhLl /k3ZEhMaYffcGAyh/ERulxHXUz/0BLTxC/ktPUmHUvkbcTkEdnxFMM8o/ut6ReB/7MCu KRVg== X-Received: by 10.58.100.197 with SMTP id fa5mr13211247veb.24.1390748911243; Sun, 26 Jan 2014 07:08:31 -0800 (PST) Received: from LG-LaptopW8.gmail.com (181-182-37-10.genericrev.telcel.net.ve. [181.182.37.10]) by mx.google.com with ESMTPSA id kf16sm4577551vdb.5.2014.01.26.07.08.28 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 26 Jan 2014 07:08:30 -0800 (PST) Message-ID: <52e524ee.b075340a.4538.01a5@mx.google.com> X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Date: Sun, 26 Jan 2014 10:37:54 -0430 From: LGUC Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_174644640==_" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -2.9 (--) X-Mailman-Approved-At: Sun, 26 Jan 2014 14:40:13 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: -2.9 (--) --=====================_174644640==_ Content-Type: text/html; charset="us-ascii" THE INCOMPLETE ATTACMENT! (working on sunday makes not my lucky day. Sorry for the inconveniences!.
Please disregard the previous 2 mails)


Caracas, Sunday 26th, 2014

Ref: Bug report for 'head' (and 'wc' et. al.)

Dear friends:

  Please find attached the text file 'head-tst.txt'
 
  As you easily can see, the following command fails and do not print
anything, even if the file has:  6 lines,  49 words and  250 chars:

  'head -n -0 head-tst.txt'

  The last line on the file does NOT end with a '\n', and this seems
to be the base of the problem. If you add the last '\n', 'head' works
pretty fine.

  So this seems to be a problem with the definition of a 'text line':
I guess that a line that has around 68 normal chars and 13 spaces, is
a good candidate to be considered as a line.

  I found the same problem in several other core utils, being the
most remarcable 'wc'. If you executes:

  'wc head-tst.txt'

  you will get:

    5  49 250 head-tst.txt

  what is wrong, as the file has six (6) lines instead of five (5).
The last one line is missing due to the fact that it does not
include a '\n' at the end.

  In 1998 I fix 'wc', and I have attached 'wc-fix.c' including only
the most remarkable aspects, in case it could be of any help.


Best regards,

Luis G. Uribe C.


Attachments inside 'head-tst.zip':
- 'head-tst.txt': text file that makes 'head' core utility to fail
- 'wc-fix.c':     fix to same problem, applyied to 'wc' in 1998

Software ID:
   GNU coreutils 8.15  January 2012  HEAD(1)
   (Cygwin)
--=====================_174644640==_ Content-Type: application/octet-stream; name="head-tst.zip" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="head-tst.zip" UEsDBBQAAgAIABEWOkT9UhumqAAAAPoAAAAMAAAAaGVhZC10c3QudHh0Vc5BC4JAEIbhu+B/+Drt Ja1znSISBNMgIQIvm67t0jJCO2H++2wNwusM8z6TJmCtYKVjWEMKWjrkRQlJUNQYukNUJJYQWskG ESFaC7DjmN+MVhrr4jAIg9m6754PhyTND+gN67E1oDVWjZRkL8zNCQoD4Db8OJ/z+SnB2jjf8Fr2 vbqsinFC0qKiDfoaTaem3+vuRQzDW/y/QrJLszP2xfGUHcrsuvgAUEsDBBQAAgAIACoVOkQs77f0 EQEAAGMCAAAIAAAAd2MtZml4LmN1UtFKwzAUfR/sH86e1rGatEXEOfog0okwENThy0BYlmqgS6VN qeL67zbp1jZz3hDIPck9OecmlKJkF7H4crEsRI57glUmNhx3xIU/m11T36NBAASef0k9nwZXwwEA SkEIOU4DlR8i4Q4cMIR454o5iD8xqQdGIRA9LurljzmqY/OteI7pdN4iLC2kekuE5DXBy9Mq6rZE bGhDjOux3x/Wa9VPZD/JxtZlhkOWabatqRe3y+cet82vaU4rdWhZtlw0beiMdBhLdzuSFsrFWt6A ZUjieWMPQiGVjP/ht8yfUVi1WcWTnBvFo6Onf63aXdShN2wfVaM5kls8xAbtIa/6UQ1oWtSJnLT1 dmdOP8Zw8AtQSwECFAAUAAIACAARFjpE/VIbpqgAAAD6AAAADAAAAAAAAAABACAAAAAAAAAAaGVh ZC10c3QudHh0UEsBAhQAFAACAAgAKhU6RCzvt/QRAQAAYwIAAAgAAAAAAAAAAQAgAAAA0gAAAHdj LWZpeC5jUEsFBgAAAAACAAIAcAAAAAkCAAAAAA== --=====================_174644640==_-- From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 26 20:12:25 2014 Received: (at control) by debbugs.gnu.org; 27 Jan 2014 01:12:25 +0000 Received: from localhost ([127.0.0.1]:37054 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7akT-0001g3-07 for submit@debbugs.gnu.org; Sun, 26 Jan 2014 20:12:25 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:63311) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7akR-0001fu-AK for control@debbugs.gnu.org; Sun, 26 Jan 2014 20:12:23 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ag4CAC+y5VJtThEL/2dsb2JhbAANTIN8gxu2VIJ8MHeDOQoqVA0CBSECEQI6BgICFQgBAYgGqll2nDAXgSmOAYJZgUkEnxaOXA Received: from unknown (HELO [192.168.1.79]) ([109.78.17.11]) by mail2.vodafone.ie with ESMTP; 27 Jan 2014 01:12:22 +0000 Message-ID: <52E5B276.80602@draigBrady.com> Date: Mon, 27 Jan 2014 01:12:22 +0000 From: =?UTF-8?B?UMOhZHJhaWcgQnJhZHk=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: control@debbugs.gnu.org X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: forcemerge 16559 16560 16561 stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [213.233.128.44 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: forcemerge 16559 16560 16561 stop [...] Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [213.233.128.44 listed in list.dnswl.org] 1.8 MISSING_SUBJECT Missing Subject: header 0.2 NO_SUBJECT Extra score for no subject forcemerge 16559 16560 16561 stop From unknown Fri Jun 20 20:09:51 2025 X-Loop: help-debbugs@gnu.org Subject: bug#16561: Bug report for 'head' (and 'wc' et. al.) Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: "Debbugs-submit" Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 27 Jan 2014 01:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16561 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: LGUC Cc: 16561@debbugs.gnu.org Received: via spool by 16561-submit@debbugs.gnu.org id=B16561.139078586711954 (code B ref 16561); Mon, 27 Jan 2014 01:25:02 +0000 Received: (at 16561) by debbugs.gnu.org; 27 Jan 2014 01:24:27 +0000 Received: from localhost ([127.0.0.1]:37059 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7aw6-00036i-Kq for submit@debbugs.gnu.org; Sun, 26 Jan 2014 20:24:26 -0500 Received: from mail2.vodafone.ie ([213.233.128.44]:41132) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W7aw4-00036X-7u; Sun, 26 Jan 2014 20:24:25 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApkFAIq05VJtThEL/2dsb2JhbAANTINEUKJPAQGWDYN+gR6DGQEBAQMBMgFGBQsLDQsJFg8JAwIBAgFFBg0BBwEBh3kNA6pSk2uJPBePDQeEOAEDjgGLWIU9hXGIaw Received: from unknown (HELO [192.168.1.79]) ([109.78.17.11]) by mail2.vodafone.ie with ESMTP; 27 Jan 2014 01:24:23 +0000 Message-ID: <52E5B547.2030206@draigBrady.com> Date: Mon, 27 Jan 2014 01:24:23 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <52e524ee.b075340a.4538.01a5@mx.google.com> In-Reply-To: <52e524ee.b075340a.4538.01a5@mx.google.com> X-Enigmail-Version: 1.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 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: 0.0 (/) forcemerge 16561 16329 stop On 01/26/2014 03:07 PM, LGUC wrote: > THE INCOMPLETE ATTACMENT! (working on sunday makes not my lucky day. > Sorry for the inconveniences!. > Please disregard the previous 2 mails) > __________________________________________________________________ > > Caracas, Sunday 26th, 2014 > Ref: Bug report for 'head' (and 'wc' et. al.) > Dear friends: > Please find attached the text file 'head-tst.txt' > > As you easily can see, the following command fails and do not print > anything, even if the file has: 6 lines, 49 words and 250 chars: > 'head -n -0 head-tst.txt' > The last line on the file does NOT end with a '\n', and this seems > to be the base of the problem. If you add the last '\n', 'head' works > pretty fine. Right that's an issue, coincidentally recently reported: http://bugs.gnu.org/16329 We'll include the fix for that soon. > So this seems to be a problem with the definition of a 'text line': > I guess that a line that has around 68 normal chars and 13 spaces, is > a good candidate to be considered as a line. > I found the same problem in several other core utils, being the > most remarcable 'wc'. If you executes: > 'wc head-tst.txt' > you will get: > 5 49 250 head-tst.txt > what is wrong, as the file has six (6) lines instead of five (5). > The last one line is missing due to the fact that it does not > include a '\n' at the end. > In 1998 I fix 'wc', and I have attached 'wc-fix.c' including only > the most remarkable aspects, in case it could be of any help. So wc is different and is defined by POSIX to only count '\n' chars. So we can't change that really. We might be able to add a --visible-lines option that would handle this and also unicode line separators etc. But that would require more debate since it would be a new option. thanks, Pádraig.