Subject: bug#6296: closed (Re: bug#6296: sort -c not using proper keyspec)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 29 May 2010 23:37:02 +0000

Your bug report

#6296: sort -c not using proper keyspec

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
6296: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6296
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#6296: sort -c not using proper keyspec
From: Pádraig Brady <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Sun, 30 May 2010 00:32:52 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

tags 6296 + notabug

On 28/05/10 21:04, [email-masked] wrote:
> CoreUtils,
> 
> I believe sort(1) is not honoring the keyspec I provide in the case of a '-c' run. Here's a small file and the behavior I'm seeing.
> 
> I realize sort keyspecs can be tricky -- I hope this is not a case of user error!
> 
> Thanks,
> Jim
> 
> $ head -5 x.scan.txt
> 1 5242857 + 25 1
> 1 15728631 + 25 1
> 1 17825783 + 25 1
> 1 36700126 + 50 1
> 1 36700126 + 47 1
> 
> $ awk '{print $1,$2}' x.scan.txt|sort -c -k1,1n -k2,2n
> 
> $ sort -c -k1,1n -k2,2n x.scan.txt
> sort: x.scan.txt:5: disorder: 1 36700126 + 47 1
> 
> $ sort --version
> sort (GNU coreutils) 8.5
> Packaged by Cygwin (8.5-1)

The next released version of coreutils will have
the sort --debug option which illustrates what's happening:

$ sort --debug -c -k1,1n -k2,2n x.scan.txt
sort: using `en_IE.UTF-8' sorting rules
sort: x.scan.txt:5: disorder:
1 36700126 + 47 1
_
  ________
_________________

So the last resort comparison is causing the issue,
and you can disable that by also specifying the -s option.

cheers,
Pádraig.

Subject: sort -c not using proper keyspec
From: <[email-masked]>
To: <[email-masked]>
Date: Fri, 28 May 2010 14:04:44 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

CoreUtils,

I believe sort(1) is not honoring the keyspec I provide in the case of a '-c' run. Here's a small file and the behavior I'm seeing.

I realize sort keyspecs can be tricky -- I hope this is not a case of user error!

Thanks,
Jim

$ head -5 x.scan.txt
1 5242857 + 25 1
1 15728631 + 25 1
1 17825783 + 25 1
1 36700126 + 50 1
1 36700126 + 47 1

$ awk '{print $1,$2}' x.scan.txt|sort -c -k1,1n -k2,2n

$ sort -c -k1,1n -k2,2n x.scan.txt
sort: x.scan.txt:5: disorder: 1 36700126 + 47 1

$ sort --version
sort (GNU coreutils) 8.5
Packaged by Cygwin (8.5-1)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Mike Haertel and Paul Eggert.