Subject: bug#23214: closed (Re: bug#23214: Possible bug in sort -g)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 04 Apr 2016 15:55:02 +0000

Your bug report

#23214: Possible bug in sort -g

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].

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

Subject: Re: bug#23214: Possible bug in sort -g
From: Paul Eggert <[email-masked]>
To: Matthijs Nescio <[email-masked]>
Cc: [email-masked]
Date: Mon, 4 Apr 2016 08:54:02 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

Subject: Possible bug in sort -g
From: Matthijs Nescio <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Mon, 4 Apr 2016 13:46:46 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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.