mirror of
https://src.fedoraproject.org/rpms/grub2.git
synced 2024-11-28 07:44:52 +00:00
3f3dfd4006
- Various grub2 cleanups (pbrobinson) - Another fix for blscfg variable expansion support - blscfg: Add support for sorting the plus ('+') higher than base version Resolves: rhbz#1767395 Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
59 lines
2.1 KiB
Diff
59 lines
2.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Javier Martinez Canillas <javierm@redhat.com>
|
|
Date: Mon, 4 Nov 2019 17:33:30 +0100
|
|
Subject: [PATCH] blscfg: Add support for sorting the plus ('+') higher than
|
|
base version
|
|
|
|
Handle plus separator. Concept is the same as tilde, except that if one of
|
|
the strings ends (base version), the other is considered as higher version.
|
|
|
|
A plus character is used for example by the Linux kernel build system to
|
|
denote that is the base version plus some changes on top of it.
|
|
|
|
Currently for example rpmvercmp("5.3.0", "5.3.0+") will return 0 even when
|
|
the two versions are not the same.
|
|
|
|
Resolves: rhbz#1767395
|
|
|
|
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
|
|
---
|
|
grub-core/commands/blscfg.c | 19 +++++++++++++++++--
|
|
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
|
|
index d78cff79f97..83b33c1cd93 100644
|
|
--- a/grub-core/commands/blscfg.c
|
|
+++ b/grub-core/commands/blscfg.c
|
|
@@ -163,8 +163,8 @@ static int vercmp(const char * a, const char * b)
|
|
|
|
/* loop through each version segment of str1 and str2 and compare them */
|
|
while (*one || *two) {
|
|
- while (*one && !grub_isalnum(*one) && *one != '~') one++;
|
|
- while (*two && !grub_isalnum(*two) && *two != '~') two++;
|
|
+ while (*one && !grub_isalnum(*one) && *one != '~' && *one != '+') one++;
|
|
+ while (*two && !grub_isalnum(*two) && *two != '~' && *two != '+') two++;
|
|
|
|
/* handle the tilde separator, it sorts before everything else */
|
|
if (*one == '~' || *two == '~') {
|
|
@@ -175,6 +175,21 @@ static int vercmp(const char * a, const char * b)
|
|
continue;
|
|
}
|
|
|
|
+ /*
|
|
+ * Handle plus separator. Concept is the same as tilde,
|
|
+ * except that if one of the strings ends (base version),
|
|
+ * the other is considered as higher version.
|
|
+ */
|
|
+ if (*one == '+' || *two == '+') {
|
|
+ if (!*one) return -1;
|
|
+ if (!*two) return 1;
|
|
+ if (*one != '+') goto_return (1);
|
|
+ if (*two != '+') goto_return (-1);
|
|
+ one++;
|
|
+ two++;
|
|
+ continue;
|
|
+ }
|
|
+
|
|
/* If we ran to the end of either, we are finished with the loop */
|
|
if (!(*one && *two)) break;
|
|
|