bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: Iconsistent ls sorting with and without `v'


From: Andrey Borzenkov
Subject: Re: Iconsistent ls sorting with and without `v'
Date: Sat, 10 May 2003 19:25:24 +0400
User-agent: KMail/1.5

On Saturday 10 May 2003 13:39, Jim Meyering wrote:
> Andrey Borzenkov <address@hidden> wrote:
> > info ls
> >
> > `-v'
> > `--sort=version'
> >      Sort by version name and number, lowest first.  It behaves like a
> >      default sort, except that each sequence of decimal digits is
> >      treated numerically as an index/version number.  (*Note More
> >      details about version sort::.)
> >
> > where default sort is defined as ...
> >
> >    By default, the output is sorted alphabetically, according to the
> > locale settings in effect.
> >
> > {pts/2}% ls
> > a  A  b  B  c  C
> > {pts/2}% ls -v
> > A  B  C  a  b  c
> > {pts/2}% echo $LANG
> > ru_RU.KOI8-R
> >
> > The first output (without -v) is correct according to locale setings
> > (I do not like this order but it is not related to the problem :)
>
> Thank you for the complete problem report!
>
> ls -v uses the strverscmp function.
> The inconsistency you noticed is due to the fact that the strverscmp
> function (as documented):
>
>   ... does not use the locale category  LC_COLLATE,  so  is  meant
>   mostly for situations where the strings are expected to be in ASCII.
>

That makes it rather useless for any codeset except trivial ASCII. Even 
standard iso-8859-1 does not sort in numeric order not mentioning koi8 or 
utf8.

> As you've probably guessed, this is not a bug in ls,
> but rather a case of insufficient documentation.
>

Sure, it is always possible to document bug that converts it into "works as 
documented" case :))

In any case, Mandrake sets default alias to 

l='ls -xFv'
la='ls -laFv'
ll='ls -lFv'
lr='ls -RFvx'

i.e. it botches sorting in any locale that does not use US-ASCII. 

Would you consider to change ls behaiour? Else may I ask to change default 
aliases as used in Mandrake? It is rather confusing currently.

thank you

-andrey




reply via email to

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