Bug 309131 - output of wc has been changed
output of wc has been changed
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: coreutils (Show other bugs)
4.5
All Linux
low Severity low
: ---
: ---
Assigned To: Ondrej Vasik
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-09-27 10:47 EDT by Chuck Mead
Modified: 2008-08-12 08:23 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-08-12 08:23:10 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Chuck Mead 2007-09-27 10:47:25 EDT
Description of problem: Under rhel3 wc -l /etc/passwd would output with 3 spaces
in front of the numeric line count. Under rhel4 it does not. I cannot find
anything in the changelog for rhel4's coreutils to explain the difference in the
output and it is breaking pre-existing scripts.


Version-Release number of selected component (if applicable):
coreutils-4.5.3-26 on rhel3
coreutils-5.2.1-31.6 on rhel4

How reproducible:


Steps to Reproduce:
1. run wc -l /etc/passwd on rhel3
2. run wc -l /etc/passwd on rhel4
3.  On rhel4 it does not.
  
Actual results:
The output on rhel4 has no leading spaces/

Expected results:
The output on rhel3 has leading spaces.

Additional info: This breaks scripts and it is an undocumented change.
Comment 1 Chuck Mead 2007-09-27 11:13:22 EDT
I checked the changelogs at gnu and the --changelog output from rpm -q coreutils
and I cannot find any mention of why this change was made... was it inadvertent?
Comment 2 Pete Graner 2007-09-27 11:26:17 EDT
This is documented in:

/usr/share/doc/coreutils-6.9/NEWS

  wc count field widths now are heuristically adjusted depending on the input
  size, if known.  If only one count is printed, it is guaranteed to
  be printed without leading spaces.

  Previously, wc did not align the count fields if POSIXLY_CORRECT was set,
  but POSIX did not actually require this undesirable behavior, so it
  has been removed.

It is also documented in: info wc

However, as a GNU extension, if only one count is printed, it is
guaranteed to be printed without leading spaces.
Comment 3 Chuck Mead 2007-09-27 11:27:54 EDT
Yeah I found the discussion at
http://lists.gnu.org/archive/html/bug-coreutils/2003-07/msg00098.html with the
evil patch which "broke" the previous behavior.
Comment 4 Ondrej Vasik 2008-08-12 08:23:10 EDT
Missed that bugzilla completely for a while. Looking at previous comments and error description, it looks like notabug for me. Change in behaviour is documented in info documentation and release NEWS file. Closing NOTABUG.

Note You need to log in before you can comment on or make changes to this bug.