[Top][All Lists]

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

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

From: Jim Meyering
Subject: bug#9780: sort -u throws out non-duplicates
Date: Thu, 16 Aug 2012 10:28:25 +0200

Jim Meyering wrote:
> Jim Meyering wrote:
>> 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.
> Hmm... The above is arch-specific.
> It triggers the bug on i686, but not on x86_64.

Here's an interesting one, this time x86_64-specific:

perl -e 'print "0\n"x5000 ."6\n"x6000 ."8\n"x3000 ."4\n"x8000 ."1\n"x2000' \
  | sed 's/^/a /'| sort -k2,2 -u --par=1 -S1k

It prints a single line:

  a 1

rather than the required five:

  a 0
  a 1
  a 4
  a 6
  a 8

reply via email to

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