Date: Tue, 7 Jun 2005 13:36:21 -0400 (EDT) From: Dan Mahoney <danm@prime.gushi.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/82005: wc utility misreports number of lines (zero) in a one line file Message-ID: <200506071736.j57HaLpj073503@prime.gushi.org> Resent-Message-ID: <200506071740.j57HeB2P031840@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Jun 07 17:40:11 GMT 2005
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506071736.j57HaLpj073503>
