GNU bug report logs - #9780
sort -u throws out non-duplicates

Previous Next

Package: coreutils;

Reported by: Bernhard Rosenkraenzer <bero <at> bero.eu>

Date: Tue, 18 Oct 2011 01:04:02 UTC

Severity: normal

Tags: moreinfo

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #46 received at 9780 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 9780 <at> debbugs.gnu.org, Rasmus Borup Hansen <rbh <at> intomics.com>
Subject: Re: 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




This bug report was last modified 12 years and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.