Subject: bug#32603: sort bug?

From: Eric Blake <[email-masked]>
Date: Fri, 31 Aug 2018 11:59:49 -0500

tag 32603 notabug
thanks

On 08/31/2018 11:44 AM, Paul Eggert wrote:
> "sort --help" says:
> 
> *** WARNING ***
> The locale specified by the environment affects sort order.
> Set LC_ALL=C to get the traditional sort order that uses
> native byte values.
> 
> and that's what you have run into.

To expound on Paul's answer:

 > $ sort <foo
 > t.co
 > tec.co
 > te.co

Let's run that with --debug to make it obvious:

$ printf 't.co\ntec.co\nte.co\n' | sort --debug
sort: using ‘en_US.UTF-8’ sorting rules
t.co
____
tec.co
______
te.co
_____

and realize that en_US.UTF-8 is a locale where punctuation is ignored 
when determining collation order (thus, 'tco' < 'tecco' < 'teco' once 
you strip out the ignored '.').

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org