On Sat, Feb 11, 2012 at 02:20:59AM +0100, [email protected] wrote:
> Hi,
> 
> Although coreutils `ls` sort filenames with some complexity that does
> not fit into busybox, IMHO busybox `ls` sorting should be
> case-insensitive to better match it.

Try this on coreutils' ls:

LC_COLLATE=C ls

You'll find that it's case-sensitive. The behavior you're seeing is
coming from using strcoll and a non-default locale.

> diff --git a/coreutils/ls.c b/coreutils/ls.c
> index d5b25ee..bc4692e 100644
> --- a/coreutils/ls.c
> +++ b/coreutils/ls.c
> @@ -899,7 +899,7 @@ static int sortcmp(const void *a, const void *b)
>               if (ENABLE_LOCALE_SUPPORT)
>                       dif = strcoll(d1->name, d2->name);
>               else
> -                     dif = strcmp(d1->name, d2->name);
> +                     dif = strcasecmp(d1->name, d2->name);

If I'm not mistaken, this patch would change the behavior in the C
locale, which is incorrect and non-conformant. If you want
case-insensitive sorting, enable locale support and setup an
appropriate locale.

Rich
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to