Making a test suite for uniq.
Manuel Novoa III
mjn3 at codepoet.org
Wed Sep 14 15:48:02 UTC 2005
Hi Rob,
On Wed, Sep 14, 2005 at 09:51:47AM -0500, Rob Landley wrote:
> 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.)
Older versions of gnu uniq also seperate also seperate the count from
the line with a tab rather than a space.
> 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.
I said I'd get to it this week. The week isn't over yet.
> 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.
Again, older versions of gnu uniq didn't behave this way. They treated
-d and -u as mutually exclusive and the last one was honered.
>
> Rob
>
> P.S. Yeah, I get a bit pedantic when I'm claiming compliance with an official
> formal specification. But currently, we're wrong.
Fine with me. I'll incorporate those changes. I'll also add an option
to the config system to toggle gnu-ish leading whitespace if you like.
Manuel
P.S. Older version tested was uniq (coreutils) 4.5.3
More information about the busybox
mailing list