From unknown Tue Aug 19 00:33:57 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#6296 <6296@debbugs.gnu.org> To: bug#6296 <6296@debbugs.gnu.org> Subject: Status: sort -c not using proper keyspec Reply-To: bug#6296 <6296@debbugs.gnu.org> Date: Tue, 19 Aug 2025 07:33:57 +0000 retitle 6296 sort -c not using proper keyspec reassign 6296 coreutils submitter 6296 severity 6296 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri May 28 16:40:52 2010 Received: (at submit) by debbugs.gnu.org; 28 May 2010 20:40:52 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OI6MN-0001Q2-Hu for submit@debbugs.gnu.org; Fri, 28 May 2010 16:40:52 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OI5nb-00018u-BV for submit@debbugs.gnu.org; Fri, 28 May 2010 16:04:55 -0400 Received: from lists.gnu.org ([199.232.76.165]:42381) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OI5nW-0000XA-V5 for submit@debbugs.gnu.org; Fri, 28 May 2010 16:04:51 -0400 Received: from [140.186.70.92] (port=60373 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OI5nV-0006gI-2K for bug-coreutils@gnu.org; Fri, 28 May 2010 16:04:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OI5nT-0004Bf-SD for bug-coreutils@gnu.org; Fri, 28 May 2010 16:04:48 -0400 Received: from aglcosbs01.cos.agilent.com ([192.25.218.35]:58634) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OI5nT-0004B3-Nu for bug-coreutils@gnu.org; Fri, 28 May 2010 16:04:47 -0400 Received: from 2k7hubs.agilent.com (cos-us-ht01.agilent.com [130.29.28.11]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by aglcosbs01.cos.agilent.com (Postfix) with ESMTP id 6DB6E29AB6 for ; Fri, 28 May 2010 20:04:45 +0000 (GMT) Received: from cos-us-ht03.agilent.com (130.29.152.190) by cos-us-ht01.agilent.com (130.29.28.11) with Microsoft SMTP Server (TLS) id 8.2.254.0; Fri, 28 May 2010 14:04:45 -0600 Received: from cos-us-mb14.agilent.com ([130.29.152.240]) by cos-us-ht03.agilent.com ([130.29.152.190]) with mapi; Fri, 28 May 2010 14:04:44 -0600 From: To: Date: Fri, 28 May 2010 14:04:44 -0600 Subject: sort -c not using proper keyspec Thread-Topic: sort -c not using proper keyspec Thread-Index: Acr+oQPbx4r+xPpAT5qVz2IwgRdgiQ== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.95.3 at aglcosbs01.cos.agilent.com X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 28 May 2010 16:40:51 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) 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 . 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. From debbugs-submit-bounces@debbugs.gnu.org Sat May 29 19:36:08 2010 Received: (at 6296-done) by debbugs.gnu.org; 29 May 2010 23:36:08 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OIVZW-0005kz-Ql for submit@debbugs.gnu.org; Sat, 29 May 2010 19:36:07 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OIVZV-0005kd-1v for 6296-done@debbugs.gnu.org; Sat, 29 May 2010 19:36:05 -0400 Received: (qmail 6408 invoked from network); 29 May 2010 23:35:59 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 29 May 2010 23:35:59 -0000 Message-ID: <4C01A424.6030308@draigBrady.com> Date: Sun, 30 May 2010 00:32:52 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: jim_eberle@non.agilent.com Subject: Re: bug#6296: sort -c not using proper keyspec References: In-Reply-To: X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.8 (--) X-Debbugs-Envelope-To: 6296-done Cc: 6296-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.8 (--) tags 6296 + notabug On 28/05/10 21:04, jim_eberle@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. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 01 13:10:45 2010 Received: (at 6296-done) by debbugs.gnu.org; 1 Jun 2010 17:10:45 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJUzE-0000w3-Kq for submit@debbugs.gnu.org; Tue, 01 Jun 2010 13:10:44 -0400 Received: from aglcosbs03.cos.agilent.com ([192.25.218.43]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJUzC-0000vx-Ct for 6296-done@debbugs.gnu.org; Tue, 01 Jun 2010 13:10:43 -0400 Received: from 2k7hubs.agilent.com (cos-us-ht01.agilent.com [130.29.28.11]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by aglcosbs03.cos.agilent.com (Postfix) with ESMTP id 51E973CB37; Tue, 1 Jun 2010 17:10:37 +0000 (GMT) Received: from cos-us-mb14.agilent.com ([130.29.152.240]) by cos-us-ht01.agilent.com ([130.29.28.11]) with mapi; Tue, 1 Jun 2010 11:10:36 -0600 From: To: Date: Tue, 1 Jun 2010 11:10:36 -0600 Subject: RE: bug#6296: sort -c not using proper keyspec Thread-Topic: bug#6296: sort -c not using proper keyspec Thread-Index: Acr/h7MLKOjPToDERly2/DdIF0kEtwCJTSQg Message-ID: References: <4C01A424.6030308@draigBrady.com> In-Reply-To: <4C01A424.6030308@draigBrady.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.95.3 at aglcosbs03.cos.agilent.com X-Virus-Status: Clean X-Spam-Score: -3.8 (---) X-Debbugs-Envelope-To: 6296-done Cc: 6296-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) P=E1draig, Thank you so much for clarifying. I was not aware of the last-resort compar= ison. 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=E1draig Brady [mailto:P@draigBrady.com]=20 Sent: Saturday, May 29, 2010 4:33 PM To: EBERLE,JIM (Non-A-SantaClara,ex1) Cc: 6296-done@debbugs.gnu.org Subject: Re: bug#6296: sort -c not using proper keyspec tags 6296 + notabug On 28/05/10 21:04, jim_eberle@non.agilent.com wrote: > CoreUtils, >=20 > 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. >=20 > I realize sort keyspecs can be tricky -- I hope this is not a case of use= r error! >=20 > Thanks, > Jim >=20 > $ 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 >=20 > $ awk '{print $1,$2}' x.scan.txt|sort -c -k1,1n -k2,2n >=20 > $ sort -c -k1,1n -k2,2n x.scan.txt > sort: x.scan.txt:5: disorder: 1 36700126 + 47 1 >=20 > $ 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=E1draig. From unknown Tue Aug 19 00:33:57 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 30 Jun 2010 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator