Subject: bug#21890: "ls -l" strange alphabetical order

From: Pádraig Brady <[email-masked]>
Date: Thu, 12 Nov 2015 17:56:49 +0000

tag 21890 notabug
close 21890
stop

On 12/11/15 14:15, Andreas Papadopoulos wrote:
> I am experiencing a strange bug when executing "ls -l" on my machine running Xubuntu 14.04.3, Terminal Emulator 0.6.3 and ls --version 8.21.
> 
> As you can see in the png attachment after running "ls -l" the files "kati.xml", "kati2.xml", "kati3.xml" are wrongly sorted. I assume the correct order is "kati.xml", "kati2.xml", "kati3.xml" and not the one displayed in the picture.
> 
> Thank you in advance

This is due to '.' being ignored in your locale:

$ LC_ALL=en_US ltrace -e strcoll ls -l
ls->strcoll("kati.xml", "kati3.xml")                      = 30
ls->strcoll("kati2.xml", "kati3.xml")                     = -1

$ LC_ALL=C ltrace -e strcoll ls -l
ls->strcoll("kati.xml", "kati3.xml")                      = -5
ls->strcoll("kati2.xml", "kati.xml")                      = 4
ls->strcoll("kati2.xml", "kati3.xml")                     = -1

You might want to consider alias ls='ls -v'

thanks,
Pádraig