GNU bug report logs - #6296
sort -c not using proper keyspec

Previous Next

Package: coreutils;

Reported by: <jim_eberle <at> non.agilent.com>

Date: Fri, 28 May 2010 20:41:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6296 in the body.
You can then email your comments to 6296 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6296; Package coreutils. (Fri, 28 May 2010 20:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to <jim_eberle <at> non.agilent.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 28 May 2010 20:41:02 GMT) Full text and rfc822 format available.

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

From: <jim_eberle <at> non.agilent.com>
To: <bug-coreutils <at> gnu.org>
Subject: sort -c not using proper keyspec
Date: Fri, 28 May 2010 14:04:44 -0600
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.




Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sat, 29 May 2010 23:37:02 GMT) Full text and rfc822 format available.

Notification sent to <jim_eberle <at> non.agilent.com>:
bug acknowledged by developer. (Sat, 29 May 2010 23:37:02 GMT) Full text and rfc822 format available.

Message #10 received at 6296-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: jim_eberle <at> non.agilent.com
Cc: 6296-done <at> debbugs.gnu.org
Subject: Re: bug#6296: sort -c not using proper keyspec
Date: Sun, 30 May 2010 00:32:52 +0100
tags 6296 + notabug

On 28/05/10 21:04, jim_eberle <at> non.agilent.com 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.




Message #11 received at 6296-done <at> debbugs.gnu.org (full text, mbox):

From: <jim_eberle <at> non.agilent.com>
To: <P <at> draigBrady.com>
Cc: 6296-done <at> debbugs.gnu.org
Subject: RE: bug#6296: sort -c not using proper keyspec
Date: Tue, 1 Jun 2010 11:10:36 -0600
Pádraig,

Thank you so much for clarifying. I was not aware of the last-resort comparison. Using -s does indeed do the job.

My terabytes of data (that really don't need sorting) thank you as well.

Jim

-----Original Message-----
From: Pádraig Brady [mailto:P <at> draigBrady.com] 
Sent: Saturday, May 29, 2010 4:33 PM
To: EBERLE,JIM (Non-A-SantaClara,ex1)
Cc: 6296-done <at> debbugs.gnu.org
Subject: Re: bug#6296: sort -c not using proper keyspec

tags 6296 + notabug

On 28/05/10 21:04, jim_eberle <at> non.agilent.com 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Jun 2010 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 53 days ago.

Previous Next


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