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

2014-02-17 15:40 GMT+01:00 Jarosław Rzeszótko <[email protected]>:

> 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