[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian version numbers and strcmp()



On Fri, Jan 23, 2009 at 12:40:46PM +0200, Guillem Jover wrote:
> Hi!
> 
> On Thu, 2009-01-22 at 15:19:40 +0100, Adeodato Simó wrote:
> > I'd like to hear from members of this list what they think about the
> > following issue: I just noticed that to determine whether two Debian
> > versions are equal, one can't use strcmp() or similar, and must
> > implement the full comparison algorithm. For example, 0.9 and 0.09 are
> > the same version according to Policy.
> 
> I think that the correct solution to your problem is not to change the
> comparison algorithm, but to have available implementations of it or
> bindings in all needed programming languages, so that it does not need
> to be reimplemented every time. AFAIK we have right now:
> 
>  * shell (dpkg --compare-versions)
>  * C++ (libapt)
>  * perl (libapt-pkg-perl, dpkg-dev [not public yet])
>  * python (python-apt)
>  * ruby ?
> 
> There's probably more I'm missing, but the most ovbious one is the C
> implementation. But exposing a libdpkg with it is high on my TODO for
> dpkg 1.15.x.

Having a canonical implementation of the version comparison in a C
library would be super, since all the other languages could just
wrap it.


Regards,
Roger

(who has just been writing yet another implementation in PL/Perl and
PL/pgSQL, but ended up wrapping the libapt implementation.)

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: signature.asc
Description: Digital signature


Reply to: