michal-grzedzicki / rpms / rpm

Forked from rpms/rpm 5 months ago
Clone

Blame SOURCES/0001-Consolidate-allowed-version-release-evr-allowed-char.patch

672c60
From e8fce62467a421132f4ebb6ca9c0926b623ec00e Mon Sep 17 00:00:00 2001
672c60
Message-Id: <e8fce62467a421132f4ebb6ca9c0926b623ec00e.1574338687.git.pmatilai@redhat.com>
672c60
From: Panu Matilainen <pmatilai@redhat.com>
672c60
Date: Tue, 27 Nov 2018 13:40:21 +0200
672c60
Subject: [PATCH 1/2] Consolidate allowed version/release/evr allowed
672c60
 characters to macros
672c60
672c60
Maintaining multiple variants of the same thing, that always worked
672c60
soooooo well... No functional changes here. Unless I truly messed up.
672c60
---
672c60
 build/parsePreamble.c     | 2 +-
672c60
 build/parseReqs.c         | 2 +-
672c60
 build/rpmbuild_internal.h | 2 ++
672c60
 3 files changed, 4 insertions(+), 2 deletions(-)
672c60
672c60
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
672c60
index 2d54abeee..f5e06bac8 100644
672c60
--- a/build/parsePreamble.c
672c60
+++ b/build/parsePreamble.c
672c60
@@ -772,7 +772,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
672c60
     case RPMTAG_VERSION:
672c60
     case RPMTAG_RELEASE:
672c60
 	SINGLE_TOKEN_ONLY;
672c60
-	if (rpmCharCheck(spec, field, "._+%{}~"))
672c60
+	if (rpmCharCheck(spec, field, WHITELIST_VERREL))
672c60
 	   goto exit;
672c60
 	headerPutString(pkg->header, tag, field);
672c60
 	break;
672c60
diff --git a/build/parseReqs.c b/build/parseReqs.c
672c60
index 2201eebf1..9b081a5ff 100644
672c60
--- a/build/parseReqs.c
672c60
+++ b/build/parseReqs.c
672c60
@@ -57,7 +57,7 @@ static rpmRC checkDep(rpmSpec spec, char *N, char *EVR, char **emsg)
672c60
             rasprintf(emsg, _("Versioned file name not permitted"));
672c60
             return RPMRC_FAIL;
672c60
         }
672c60
-        if (rpmCharCheck(spec, EVR, ".-_+:%{}~"))
672c60
+        if (rpmCharCheck(spec, EVR, WHITELIST_EVR))
672c60
             return RPMRC_FAIL;
672c60
 	if (checkSep(EVR, '-', emsg) != RPMRC_OK ||
672c60
 	    checkSep(EVR, ':', emsg) != RPMRC_OK ||
672c60
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
672c60
index 86cc549a7..f758e6620 100644
672c60
--- a/build/rpmbuild_internal.h
672c60
+++ b/build/rpmbuild_internal.h
672c60
@@ -18,6 +18,8 @@
672c60
 #undef HTDATATYPE
672c60
 
672c60
 #define WHITELIST_NAME ".-_+%{}"
672c60
+#define WHITELIST_VERREL "._+%{}~"
672c60
+#define WHITELIST_EVR WHITELIST_VERREL "-:"
672c60
 
672c60
 struct TriggerFileEntry {
672c60
     int index;
672c60
-- 
672c60
2.23.0
672c60