Unwanted natural sorting of numbers

MP singularita at gmail.com
Fri Dec 4 02:36:17 UTC 2009


I have noticed, that when I have case in sensitive sorting set, MC
uses this bad sorting:
00050.jpg 51.gif 00054.jpg

When I set sorting to case sensitive, then these numbers are sorted
correctly, but the sort is then case sensitive, which is something I
don't want...

I spotted this behavior in git some months ago

As for locales, the only locale related env. vars I use are these:
LC_COLLATE=C
LC_CTYPE=en_US.UTF-8

> Yes, it looks like this issue has to do with your specific setup. I'm
>  not implying that it is NOT an mc problem, but at least for now we
>  couldn't reproduce it.

As I've found out in my setup, only case insensitive sort suffers from
this problem, when MC is build with --enable-charset configuire option
(though I think that option is now default since some time ago)

>  > Is there anything else I can do, try or post about my system that
>  > might help determine what's going on?
>
> Your best bet would be to open a ticket on the Trac with all relevant
>  information as not all of the developers follow the list. Maybe someone
>  will then come up with a test case to isolate the problem.

There is already ticked for this I opened 4 months ago.
http://www.midnight-commander.org/ticket/1536

Perhaps just put any additional information there.

Since I also encounter this misbehavior on my system and in about 3 or
4 directories this sort order annoys me slightly, I think I'll look at
this bug further.

When I looked at the cause, I found out that some glib functions are
called for sorting filenames (with my settings in ./configure), so
there is no string sorting directly inside mc used for that - in my
brief look before 4 months I found no trivial way to tell glib "sort
strings with number in them like any other strings" (otherwise I would
have sent a patch), so I guess I'll have to study glib documentation a
bit further to find a way to fix it.

Note: some newer unicode FAR releases have option to use/not use
similar numeric sort. Perhaps we can have this in MC too.

Martin Petricek



More information about the mc-devel mailing list