Making a test suite for uniq.

Rob Landley rob at landley.net
Wed Sep 14 14:51:47 UTC 2005


So I just checked in a new test suite for uniq (trying to get full susv3 
coverage), and I've found two failure cases.  Both of these are explicit 
violations of the spec, which gnu gets right.

1) In gnu, "uniq -c" has a space between the number and the line, and we have 
a tab.  SUSv3 actually specifies that this should be a space. 

OUTPUT FILES
  If the -c option is specified, the output file shall be empty or each line 
  shall be of the form:
  "%d %s", <number of duplicates>, <line>

  otherwise, the output file shall be empty or each line shall be of the form:
  "%s", <line>

(Technically the leading space is a violation of the spec too, but since gnu 
does it I phrased the test to accept but not require it.)

By the way, I fixed this in my checkin last week, and you reverted it along 
with everything else.  I also note that the warnings you put back are still 
there.

2) In gnu, "uniq -d -u" prints nothing at all, and this follows the spec:

-d  Suppress the writing of lines that are not repeated in the input.
-u  Suppress the writing of lines that are repeated in the input.

Therefore, you specify both you suppress both.

Rob

P.S. Yeah, I get a bit pedantic when I'm claiming compliance with an official 
formal specification.  But currently, we're wrong.



More information about the busybox mailing list