[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issue with ls -v / sort -V and strverscmp() usage
From: |
Kamil Dudka |
Subject: |
Re: Issue with ls -v / sort -V and strverscmp() usage |
Date: |
Wed, 17 Sep 2008 11:03:20 +0200 |
User-agent: |
KMail/1.9.9 |
On Sunday 07 September 2008 08:28:11 Jim Meyering wrote:
> IMHO, changing sort -V to produce more intuitively-correct results
> is the way to go.
>
> With ls -v, I'm willing to make the change as well, *assuming*
> no one produces a counterargument.
>
> The question is what ordering function to use.
> The more generally-useful the better. i.e., I hope
> it can be compatible with both the rpm and deb version sorters.
I made an investigation of existing functions which sort version strings:
strverscmp - from glibc (now with its equivalent in gnulib)
rpmvercmp - from rpm
ververcmp - from dpkg
The main problem of all these functions is dealing with suffixes. So I
modified them to drop the suffixes. So it is 6 implementations together (3
original + 3 modified).
Then I ran a few series of tests with all implementations. I think the
modified version of ververcmp (from dpkg) gives the best results - consider
attached results of an example - results.tar.bz2
So I propose a new function filevercmp (attachment filevercmp.c) as the
predicate function for new sort --version-sort.
In the attachment is also the whole "testing framework" which I used to
compare these functions - strverscmp.tar.bz2 - follow the steps in README
inside archive. It is developed a bit quickly but I hope it could be
useful :-)
Kamil
filevercmp.c
Description: Text Data
results.tar.bz2
Description: application/tbz
strverscmp.tar.bz2
Description: application/tbz
- Issue with ls -v / sort -V and strverscmp() usage, Ondřej Vašík, 2008/09/03
- Re: Issue with ls -v / sort -V and strverscmp() usage, Bruno Haible, 2008/09/03
- Re: Issue with ls -v / sort -V and strverscmp() usage, Kamil Dudka, 2008/09/03
- Re: Issue with ls -v / sort -V and strverscmp() usage, Jim Meyering, 2008/09/07
- Re: Issue with ls -v / sort -V and strverscmp() usage,
Kamil Dudka <=
- Re: Issue with ls -v / sort -V and strverscmp() usage, Bruno Haible, 2008/09/17
- Re: Issue with ls -v / sort -V and strverscmp() usage, Kamil Dudka, 2008/09/17
- Re: Issue with ls -v / sort -V and strverscmp() usage, Kamil Dudka, 2008/09/18
- Re: Issue with ls -v / sort -V and strverscmp() usage, Bruno Haible, 2008/09/21
- Re: Issue with ls -v / sort -V and strverscmp() usage, Ben Pfaff, 2008/09/21
- Re: Issue with ls -v / sort -V and strverscmp() usage, Bruno Haible, 2008/09/21
- willing to contribute verrevcmp to gnulib?, Ben Pfaff, 2008/09/21
- Re: willing to contribute verrevcmp to gnulib?, Jim Meyering, 2008/09/29
- Re: willing to contribute verrevcmp to gnulib?, Ian Jackson, 2008/09/29
- Re: willing to contribute verrevcmp to gnulib?, Jim Meyering, 2008/09/29