teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.13.0-non-numeric-epoch.patch

Lubos Kardos b73ac8
From f5bab7c054de3607d43dcc5ee8a04c2e3cd46926 Mon Sep 17 00:00:00 2001
Lubos Kardos b73ac8
From: Lubos Kardos <lkardos@redhat.com>
Lubos Kardos b73ac8
Date: Fri, 23 Oct 2015 12:20:45 +0200
Lubos Kardos b73ac8
Subject: [PATCH] Warn if epoch is not unsigned integer (rhbz:1251453)
Lubos Kardos b73ac8
Lubos Kardos b73ac8
---
Lubos Kardos b73ac8
 build/parseReqs.c | 18 ++++++++++++++++++
Lubos Kardos b73ac8
 1 file changed, 18 insertions(+)
Lubos Kardos b73ac8
Lubos Kardos b73ac8
diff --git a/build/parseReqs.c b/build/parseReqs.c
Lubos Kardos b73ac8
index bef0a2b..acdfeb9 100644
Lubos Kardos b73ac8
--- a/build/parseReqs.c
Lubos Kardos b73ac8
+++ b/build/parseReqs.c
Lubos Kardos b73ac8
@@ -25,6 +25,22 @@ static rpmRC checkSep(const char *s, char c, char **emsg)
Lubos Kardos b73ac8
     return RPMRC_OK;
Lubos Kardos b73ac8
 }
Lubos Kardos b73ac8
 
Lubos Kardos b73ac8
+static rpmRC checkEpoch(const char *s, char **emsg)
Lubos Kardos b73ac8
+{
Lubos Kardos b73ac8
+    const char *si, *sep = strchr(s, ':');
Lubos Kardos b73ac8
+
Lubos Kardos b73ac8
+    if (!sep)
Lubos Kardos b73ac8
+	return RPMRC_OK;
Lubos Kardos b73ac8
+
Lubos Kardos b73ac8
+    for (si = s; si != sep; si++) {
Lubos Kardos b73ac8
+	if (!risdigit(*si)) {
Lubos Kardos b73ac8
+	    rasprintf(emsg, "Invalid version (epoch must be unsigned integer): %s", s);
Lubos Kardos b73ac8
+	    break;
Lubos Kardos b73ac8
+	}
Lubos Kardos b73ac8
+    }
Lubos Kardos b73ac8
+    return RPMRC_OK;
Lubos Kardos b73ac8
+}
Lubos Kardos b73ac8
+
Lubos Kardos b73ac8
 static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
Lubos Kardos b73ac8
 {
Lubos Kardos b73ac8
     /* 
Lubos Kardos b73ac8
@@ -44,6 +60,8 @@ static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
Lubos Kardos b73ac8
             return RPMRC_FAIL;
Lubos Kardos b73ac8
         if (checkSep(EVR, '-', emsg) != RPMRC_OK || checkSep(EVR, ':', emsg) != RPMRC_OK)
Lubos Kardos b73ac8
             return RPMRC_FAIL;
Lubos Kardos b73ac8
+	if (checkEpoch(EVR, emsg) != RPMRC_OK)
Lubos Kardos b73ac8
+	    return RPMRC_FAIL;
Lubos Kardos b73ac8
     }
Lubos Kardos b73ac8
     return RPMRC_OK;
Lubos Kardos b73ac8
 }
Lubos Kardos b73ac8
-- 
Lubos Kardos b73ac8
1.9.3
Lubos Kardos b73ac8