From 30be52e03bbfdad738f23700e56ff1c029818eba Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 18 Dec 2018 20:31:43 +0100 Subject: [PATCH] autoupdater: consider end of string smaller than all characters except for '~' This fixes ordering for the following patterns: * 1.0 < 1.0a * 1.0a < 1.0ab * 1.0a < 1.0a1 Note that trailing zeros are still ignored (1.0 == 1., 1test0 == 1test), which matches the behaviour of dpkg and opkg. --- admin/autoupdater/src/version.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin/autoupdater/src/version.c b/admin/autoupdater/src/version.c index f1967e7..6623ad9 100644 --- a/admin/autoupdater/src/version.c +++ b/admin/autoupdater/src/version.c @@ -34,8 +34,10 @@ static int char_order(char c) { return 0; else if (isalpha(c)) return c; - else if (c == '~') + else if (c == '\0') return -1; + else if (c == '~') + return -2; else return c + 256; }