I use ISO 8601 dates, but maybe that's a moot point. The main problem is that this is not what I expect. I cannot find anything about sorting in thunar(1) or the online manual (except for sc-case-sensitive).
Hi all, thanks for your interest in a 4 years old bug. Playing around with the ls options I was able to reproduce the Thunar sorting with "-v natural sort of (version) numbers within text". What I meant in 2014 is this:
My expected sorting:
$ ls -1
20100321_foo
20120114_foo
201205_foo
2012_foo
201312_foo
How Thunar does the sorting:
$ ls -1v
2012_foo
201205_foo
201312_foo
20100321_foo
20120114_foo
No, LC_COLLATE=c did not solve it. Are you able to reproduce the sorting?
Taking a look at the source, it seems the revelent function is thunar_file_compare_by_name. It uses ThunarFile's collate_key and collate_key_nocase, both generated by g_utf8_collate_key_for_filename.
The odd thing about it is that ":" is prepended to filenames:
:::2012_foo
:::::201312_foo
:::::201205_foo
:::::::20120114_foo
:::::::20100321_foo
Numbers are handled by prepending to each number d-1 superdigits
where d = number of digits in the number and SUPERDIGIT is a
character with an integer value higher than any digit (for instance
':'). This ensures that single-digit numbers are sorted before
double-digit numbers which in turn are sorted separately from
triple-digit numbers, etc. To avoid strange side-effects when
sorting strings that already contain SUPERDIGITs, a '\2'
is also prepended, (...)
This has the side-effect of sorting numbers before everything else (except
dots), but this is probably OK.
That function usage was introduced by Bug #7110.
Needs further investigation...
That would as well explain why it is bugged for Thunar, Nemo and Nautilus --> Sufficient indication for me to close this bug :) (feel free to reopen if I should be wrong)