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
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.
The output on rhel4 has no leading spaces/
The output on rhel3 has leading spaces.
Additional info: This breaks scripts and it is an undocumented change.
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?
This is documented in:
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.
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.
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.