Subject: Re: bug#9780: sort -u throws out non-duplicates

From: Jim Meyering <[email-masked]>
Date: Thu, 16 Aug 2012 09:27:23 +0200

Jim Meyering wrote:
...
> Here's a smaller test case that appears to be host/nproc-independent:
> It should print two lines: 1, then 7.
> Without this patch, it prints only "7".
>
>     (yes 7|head -11; echo 1)|sort --parallel=1 -S32b -u
>
> Of course, it needs more/better comments, NEWS and
> tests -- and not just the one above, but also one that
> demonstrates the need for the key* adjustments below.

FYI, here's the required test:

  (yes 7|head -10; echo 1)|sed 's/^/1 /'|sort -k2,2 --p=1 -S32b -u

Without the if (key) { ... } part of my patch, it would fail.
I had to tweak the number of '7's (s/11/10) in the input to make
it trigger.