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

49 lines
1.3 KiB
Diff
Raw Normal View History

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