Collating bug with period?

Ole Laursen olau@cs.aau.dk
Wed Apr 6 11:57:00 GMT 2005


Danilo Segan <dsegan@gmx.net> writes:

> Today at 11:34, Ole Laursen wrote:
> 
> > But you could split filenames into basenames and extension, and sort
> > the basenames separately using dictionary order, couldn't you?
> 
> No.  Unless you define an algorithm for determining "basename" that
> always works:
>
> sample.gz
> sample.tar.gz
> sample.tar.gz.bz2
> simple.sample.tar.gz
> something-2.15.tar.gz
> ...
> 
> "Filename extension" is not a Unix concept.

Yeah, it is merely a convention. I think if you split at the first
dot, you will get a good approximation that also mimics would you get
with the C locale. It does not catch "sample.ramble.tar.gz", but such
constructions are rare. Note that an algorithm does not have to be
perfect to be better than what we currently have. Don't throw the baby
out with the bathwater. :-)

Admittedly, I don't see how it would help to push the sorting decision
to the locale? If you do the basename split hack, you at least have
the possibility of making the almost perfect algorithm, e.g. with a
database of extensions.

-- 
Ole Laursen
http://www.cs.aau.dk/~olau/



More information about the Libc-locales mailing list