Bug#493389: update-grub: uses wrong ordering algorithm (sorts 1.2.3-foo before 1.2.3.1-foo)
Henrique de Moraes Holschuh
hmh at debian.org
Thu Aug 7 16:10:24 UTC 2008
On Thu, 07 Aug 2008, Felix Zielcke wrote:
> Just replace the CompareVersion function with this:
>
> CompareVersions()
> {
> dpkg --compare-versions "$1" le "$2"
> echo $?
> }
That's the minimal fix, yes.
But if you do it that way, you will lose the special casing of "pre", "ac",
"rc" and etc.
> I was about unsure if I should use 'lt' 'le' 'le-nl' or 'lt-nl'
You want to return 1 for A > B and 0 otherwise. That's how the code uses
CompareVersions(). There is no reason to use -nl versions, the calling code
avoids that issue entirely.
> I try to find this now out, but please reply what you think is the best
> we should use.
> As you can see above it's very easy to test this :)
I'd be happy enough with it, but it *IS* an incomplete fix, as you are
trashdumping the special-casing of some version suffixes. At least -rc
needs to be special cased to get a ~ prefixed (sed -e 's/-rc/-~rc/'), to
sort before the final release.
--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
More information about the Pkg-grub-devel
mailing list