bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coreutils uniq -d -u does not conform to POSIX


From: Jim Meyering
Subject: Re: coreutils uniq -d -u does not conform to POSIX
Date: Wed, 14 May 2003 10:39:45 +0200

Paul Eggert <address@hidden> wrote:
> I asked my students to clone Debian GNU/Linux uniq in Python, giving
> them a POSIX-compatible uniq to start with.  Josh Hyman, one of my
> students, pointed out a disagreement between the two programs which
> turns out to be a POSIX-compatibility bug in coreutils.  POSIX says
> that "uniq -d -u" should output nothing, but with coreutils uniq, -d
> overrides -u and vice versa.
>
> Here is a proposed patch.  While I was at it I noticed a few related
> infelicities in the documentation, so this patch fixes them too.
>
> 2003-05-13  Paul Eggert  <address@hidden>
>
>       Fix uniq to conform to POSIX, which requires that "uniq -d -u"
>       must output nothing.  Problem reported by Josh Hyman.
>
>       * doc/coreutils.texi (uniq invocation, squeezing, The uniq command):
>       Use "repeated" rather than "duplicate" to describe adjacent
>       duplicates; this simplifies the description and makes it more
>       consistent with POSIX.
>       (uniq invocation): Make it clear that -d and -u suppress the
>       output of lines, rather than cause some lines to be output.
>       Mention what happens if a line lacks enough fields or characters.
>
>       * src/uniq.c (enum output_mode, mode): Remove, replacing with:
>       (output_unique, output_first_repeated, output_later_repeated):
>       New vars.  All uses of "mode" changed to use these variables,
>       which are not mutually exclusive as "mode" was.
>       (writeline): New arg "match", used to control whether to
>       obey output_first_repeated or output_later_repeated.
>       All callers changed.
>       (check_file, main): Adjust to above changes.
>
>       * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.

Thank you both!
I've applied that patch.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]