GNU bug report logs - #23214
Possible bug in sort -g

Previous Next

Package: coreutils;

Reported by: Matthijs Nescio <matthijs_1971 <at> hotmail.com>

Date: Mon, 4 Apr 2016 13:18:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

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 23214 in the body.
You can then email your comments to 23214 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 bug-coreutils <at> gnu.org:
bug#23214; Package coreutils. (Mon, 04 Apr 2016 13:18:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthijs Nescio <matthijs_1971 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 04 Apr 2016 13:18:02 GMT) Full text and rfc822 format available.

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

From: Matthijs Nescio <matthijs_1971 <at> hotmail.com>
To: "bug-coreutils <at> gnu.org" <bug-coreutils <at> gnu.org>
Subject: Possible bug in sort -g
Date: Mon, 4 Apr 2016 13:46:46 +0200
[Message part 1 (text/plain, inline)]
Hi,

I seem to have detected a bug in sort. Can you confirm?

~ $ 
~ $ sort --version
sort (GNU coreutils) 8.4
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.
~ $ cat test.txt | sort -g

2e-1
2e-1
2e-1
2e-1
1.0e-1
1.0e-2
1.0e-2
1.0e-3
1.0e-4
2.0e-1
2.0e-2
2.0e-2
2.0e-2
2.0e-2
3.0e-2
3.0e-2
3.0e-2
3.0e-2
3.0e-2
3.0e-2
15
2e+1
2e+1
2e+1
2e+1
115
119
150
2e+2
2e+2
2e+2
2e+2
2e+3
2e+3
2e+3
2e+3
~ $ cat test.txt
3.0e-2
1.0e-4
2.0e-2
3.0e-2
1.0e-1
2.0e-1
3.0e-2
1.0e-2
2.0e-2
3.0e-2
1.0e-2
2.0e-2
3.0e-2
1.0e-3
2.0e-2
3.0e-2
15
119
115
150
2e+1
2e-1
2e+3
2e+2
2e+1
2e-1
2e+3
2e+2
2e+1
2e-1
2e+3
2e+2
2e+1
2e-1
2e+3
2e+2

~ $  


I think this result is never what anybody would expect; 2e-1 is larger than 1.0e-1 and  1.0e-4 is smaller than 1.0e-1.

The above is running on Ubuntu 14.04. On a Cygwin installation the result is fine.

Thank you, kind regards, Matthijs.

 		 	   		  
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#23214; Package coreutils. (Mon, 04 Apr 2016 14:56:01 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Matthijs Nescio <matthijs_1971 <at> hotmail.com>, 23214 <at> debbugs.gnu.org
Subject: Re: bug#23214: Possible bug in sort -g
Date: Mon, 4 Apr 2016 07:54:48 -0700
On 04/04/2016 04:46 AM, Matthijs Nescio wrote:
> I seem to have detected a bug in sort. Can you confirm?
Certainly there is a problem in your 'sort' installation. Perhaps it 
depends on the locale? Try setting LC_ALL=C in your environment.

I cannot reproduce the problem with coreutils 8.4 built on Fedora 23 
x86-64, nor on Ubuntu 12.04.5 LTS x86 (this is the oldest Ubuntu release 
that is still supported). Please try building coreutils 8.4 on your 
platform, from source, and using that.

ftp://ftp.gnu.org/gnu/coreutils/coreutils-8.4.tar.gz

You may have to edit lib/stdio.h by hand, after it's built, to remove 
its declaration of 'gets'.




Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 04 Apr 2016 15:55:02 GMT) Full text and rfc822 format available.

Notification sent to Matthijs Nescio <matthijs_1971 <at> hotmail.com>:
bug acknowledged by developer. (Mon, 04 Apr 2016 15:55:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Matthijs Nescio <matthijs_1971 <at> hotmail.com>
Cc: 23214-done <at> debbugs.gnu.org
Subject: Re: bug#23214: Possible bug in sort -g
Date: Mon, 4 Apr 2016 08:54:02 -0700
On 04/04/2016 08:31 AM, Matthijs Nescio wrote:
> Hi,
>
> Indeed, setting the environment variable LC_ALL to C solves the 
> problem. Thank you. I am a satisfied long-time user of sort so I was 
> flabbergasted.

Yes, the locale can affect 'sort' in funny ways. Thanks for following 
up. Closing the bug report.




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

This bug report was last modified 9 years and 47 days ago.

Previous Next


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