GNU bug report logs - #9346
wc does not conform to POSIX (additional spaces)

Previous Next

Package: coreutils;

Reported by: Vincent Lefevre <vincent <at> vinc17.net>

Date: Tue, 23 Aug 2011 00:42:01 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Pádraig Brady <P <at> draigBrady.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#9346: closed (wc does not conform to POSIX (additional spaces))
Date: Tue, 23 Aug 2011 01:11:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Tue, 23 Aug 2011 02:07:59 +0100
with message-id <4E52FD6F.1050808 <at> draigBrady.com>
and subject line Re: bug#9346: wc does not conform to POSIX (additional spaces)
has caused the GNU bug report #9346,
regarding wc does not conform to POSIX (additional spaces)
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
9346: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9346
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Vincent Lefevre <vincent <at> vinc17.net>
To: bug-coreutils <at> gnu.org
Subject: wc does not conform to POSIX (additional spaces)
Date: Tue, 23 Aug 2011 02:39:09 +0200
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/wc.html
says:

  STDOUT

    By default, the standard output shall contain an entry for each
    input file of the form:

    "%d %d %d %s\n", <newlines>, <words>, <bytes>, <file>

But wc from GNU coreutils 8.12 adds spaces:

$ echo | wc
      1       0       1

Setting POSIXLY_CORRECT=1 doesn't even have any effect here.

-- 
Vincent Lefèvre <vincent <at> vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


[Message part 3 (message/rfc822, inline)]
From: Pádraig Brady <P <at> draigBrady.com>
To: Vincent Lefevre <vincent <at> vinc17.net>, 9346-done <at> debbugs.gnu.org
Subject: Re: bug#9346: wc does not conform to POSIX (additional spaces)
Date: Tue, 23 Aug 2011 02:07:59 +0100
tags 9346 + notabug

On 08/23/2011 01:39 AM, Vincent Lefevre wrote:
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/wc.html
> says:
> 
>   STDOUT
> 
>     By default, the standard output shall contain an entry for each
>     input file of the form:
> 
>     "%d %d %d %s\n", <newlines>, <words>, <bytes>, <file>
> 
> But wc from GNU coreutils 8.12 adds spaces:
> 
> $ echo | wc
>       1       0       1
> 
> Setting POSIXLY_CORRECT=1 doesn't even have any effect here.
> 

POSIX refers to the printf format above as a pseudo-printf format,
to contrast with the format used in SYS V of "%7d%7d%7d %s\n".
Notice the lack of spaces there, hence problems with big numbers.
So I take the POSIX printf format you referenced, just to ensure
at least 1 space is guaranteed between counts.
Also for any kind of portability, one will need to deal with
a variable number of spaces.
GNU wc uses a dynamic width (try it on a small file),
while also ensuring at least 1 space is present.

cheers,
Pádraig.


This bug report was last modified 13 years and 334 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.