bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#16778: Neither ls nor sort do a correct lexicographic sort


From: Jarosław Rzeszótko
Subject: bug#16778: Neither ls nor sort do a correct lexicographic sort
Date: Mon, 17 Feb 2014 15:43:39 +0100

(Please ignore the ls -v, that's just a mistake)


2014-02-17 15:40 GMT+01:00 Jarosław Rzeszótko <address@hidden>:

> Hi,
>
> Please contemplate the following shell session:
>
> /home/jarek # mkdir test
>
> /home/jarek # cd test
>
> /home/jarek/test # touch x_y.c
>
> /home/jarek/test # touch xs.c
>
> /home/jarek/test # ls -1
> razem 0
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 xs.c
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 x_y.c
>
> /home/jarek/test # ls -1 | sort
> razem 0
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 xs.c
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 x_y.c
>
> /home/jarek/test # ls -1 | perl -e 'print(sort(<STDIN>))'
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 x_y.c
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 xs.c
> razem 0
>
> /home/jarek/test # ls -v
> razem 0
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 xs.c
> -rw-r--r-- 1 jarek jarek 0 02-17 15:34 x_y.c
>
> /home/jarek/test # ls --version
> ls (GNU coreutils) 8.22
>
> The ordering that is produced by both ls and sort is incorrect, according
> to a widely accepted convention "x_y.c" preceeds "xs.c", as the perl
> example illustrates. I checked this on two different distributions, so it
> should not be an distribution-specific issue, rather seems a logical
> mistake in coreutils itself.
>
> Cheers,
> Jarosław Rzeszótko
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]