Bug#494158: [grub2] update-grub: uses wrong ordering algorithm (sorts 1.2.3-foo before 1.2.3.1-foo)

Felix Zielcke fzielcke at z-51.de
Fri Aug 8 13:48:54 UTC 2008


Am Freitag, den 08.08.2008, 09:49 -0300 schrieb Henrique de Moraes
Holschuh:
> On Fri, 08 Aug 2008, Felix Zielcke wrote:
> > I couldn't figure out with playing with this ~ thingy how to tell dpkg that -rc1-git1 is higher then -rc1
> 
> khazad-dum:~$ dpkg --compare-versions 2.6.23.1-rc1-git3 gt 2.6.23.1-rc1 ; echo $?
> 0
> khazad-dum:~$ dpkg --compare-versions 2.6.23.1~rc1-git3 gt 2.6.23.1~rc1 ; echo $?
> 0
> 
> It will do the right thing, as long as you don't get two "~" in there.  You
> cannot mangle the version string to ~git#~rc# (or ~-git#-~rc#, etc), as that
> will certainly not give you the right order :P

Yes and this double ~ is the problem for this -rc1 -rc1-git1 case.

> > So it seems like dpkg --compare-versions isn't that perfect for official kernel.org patch numbering ;)
> 
> No, it isn't, otherwise we would not need mangling :)  But it *CAN* do all
> that is needed, if we use "~" correctly.

I have only done very little easy things with regular expressions, so I
don't know really how to change the comparison code Robert made for
grub-legacy so that the ordering is right with dpkg.
Seems like we really need to play around with ~ to get it really right.

I wonder if that is really better with dpkg and ~ instead of our current
method.
Plain versions are luckly not a problem with dpkg, but these -rc -mm
-git and such are a problem.
The majority has probable only different base kernel numbers i.e. 2.6.25
2.6.26 and not for one base version different -rc -mm thingys.

But if we fix this now then this should be even fixed for people having
more then one of these kernels.

Btw. I think I confused again a bit with this test_gt() function in
grub2
I have modified that one too
  [ `CompareVersions "$a" "$b"` == 1 ]
  return $?

That's the current one so CompareVersions() can just be the same for
grub-legacy and grub2

Well probable better to make this change first on grub-legacy and then
adopting it to grub2 and not the other way round.






More information about the Pkg-grub-devel mailing list