From danm@prime.gushi.org  Tue Jun  7 17:31:51 2005
Return-Path: <danm@prime.gushi.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 68BE616A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  7 Jun 2005 17:31:51 +0000 (GMT)
	(envelope-from danm@prime.gushi.org)
Received: from prime.gushi.org (prime.gushi.org [65.125.228.130])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 07F1843D48
	for <FreeBSD-gnats-submit@freebsd.org>; Tue,  7 Jun 2005 17:31:50 +0000 (GMT)
	(envelope-from danm@prime.gushi.org)
Received: from prime.gushi.org (danm@localhost.gushi.org [127.0.0.1])
	by prime.gushi.org (8.13.4/8.13.4) with ESMTP id j57HaLUV073504
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 7 Jun 2005 13:36:21 -0400 (EDT)
Received: (from danm@localhost)
	by prime.gushi.org (8.13.4/8.13.4/Submit) id j57HaLpj073503;
	Tue, 7 Jun 2005 13:36:21 -0400 (EDT)
Message-Id: <200506071736.j57HaLpj073503@prime.gushi.org>
Date: Tue, 7 Jun 2005 13:36:21 -0400 (EDT)
From: Dan Mahoney <danm@prime.gushi.org>
Reply-To: Dan Mahoney <danm@prime.gushi.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: wc utility misreports number of lines (zero) in a one line file
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         82005
>Category:       bin
>Synopsis:       wc utility misreports number of lines (zero) in a one line file
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 07 17:40:11 GMT 2005
>Closed-Date:    Thu Jun 09 09:32:51 GMT 2005
>Last-Modified:  Thu Jun 09 09:32:51 GMT 2005
>Originator:     Dan Mahoney
>Release:        FreeBSD 4.10-RELEASE-p2 i386
>Organization:
>Environment:
System: FreeBSD prime.gushi.org 4.10-RELEASE-p2 FreeBSD 4.10-RELEASE-p2 #0: Fri Sep 10 21:53:55 EDT 2004 danm@prime.gushi.org:/usr/obj/usr/src/sys/PRIME49 i386

Standard make-world compile with above system.

>Description:

While playing with dos2unix, I stripped all the line endings out of a file.

I will probably open a separate bug on that front, however...

prime# file dbedit.css 
dbedit.css: ASCII text, with very long lines, with no line terminators

prime# head dbedit.css
BODY, html{     font-family: Arial, Helvetica, sans-serif;      font-size: 12px;        font-weight: normal;    color: 
#6A7E93; background-color: #E8E8E8;  margin: 0;      padding: 0;     line-height: 16px;      text-align: center;     
background-image: url(images/background-center.gif);        background-repeat: repeat-y;    background-position: 
center;}#center {  position: relative;     top: 0;     left: 0;        width: 752px;   margin-left: auto;      margin-right: 
auto;}#header {   position: relative;     height: 66px;       background-image: url(images/background.gif);   line-height: 
20px;      text-align: center;}#menuHolder {       position: relative; height: 22px;   background-image: 
url(images/menuholder.gif);}#menu {   color: #FFF;    clear:both;     position: relative;font-weight: bold;       text-align: 
left;       height: 22px;   background-image: url(images/menu.gif); line-height: 20px;}#menu :link{     color: #FFF;    
text-decoration: none;}#menu :visited, :active{ color: #FFF;    text-decoration: none;}#menu :hover{    color: #000;        
text-decoration: underline;}#content {  color: #000;    clear:both;     position: relative;     padding: 4px 5px;  text-align: 
left;}#content a:link{       color: #518CE2; font-weight: bold;      text-decoration: none;}#content a:visited, a:active{
        color: #518CE2; font-weight: bold;      text-decoration: none;}#content a:hover{        color: #55688A; font-weight: 
bold; text-decoration: underline;}prime#

prime# wc -l dbedit.css
       0 dbedit.css

>How-To-Repeat:

See above.  Create a file with no line endings and use wc -l on it.  It will return 0 rather than 1.

>Fix:

Check if file has any length at all, and don't return zero if so?  Not sure of a code-wise fix.
>Release-Note:
>Audit-Trail:

From: Lowell Gilbert <freebsd-bugs-local@be-well.no-ip.com>
To: Dan Mahoney <danm@prime.gushi.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: bin/82005: wc utility misreports number of lines (zero) in a one line file
Date: 07 Jun 2005 13:48:42 -0400

 Dan Mahoney <danm@prime.gushi.org> writes:
 
 > See above.  Create a file with no line endings and use wc -l on it.  It will return 0 rather than 1.
 
 This isn't really a bug.  It conforms to the documentation, and to the
 POSIX specification, which indicate that wc(1) should define a "line"
 as the number of newlines.  In fact, POSIX doesn't even seem to refer
 to "lines" at all, but just says that "-l" is a count of the
 "<newlines>" in the input.
State-Changed-From-To: open->closed 
State-Changed-By: tjr 
State-Changed-When: Thu Jun 9 09:26:04 GMT 2005 
State-Changed-Why:  
Not a bug; POSIX defines "line count" as the number of newline characters 
in the input file. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=82005 
>Unformatted:
