From 9fbaedd1ac655d978883d68a1f7d34df0d703363 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 21 Oct 2009 12:23:50 +0300 Subject: [PATCH] Ensure rpmlib() dependency sanity on build - only requires on rpmlib(foo) are allowed - make sure any rpmlib() foo dependencies have RPMSENSE_RPMLIB bit set, rpmdeps as external dependency generator can create rpmlib() dependencies without the bit set, and also any manual rpmlib() deps wont have it --- build/reqprov.c | 6 ++++++ build/rpmbuild.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build/reqprov.c b/build/reqprov.c index a57c6ae..9c48b11 100644 --- a/build/reqprov.c +++ b/build/reqprov.c @@ -82,6 +82,12 @@ int addReqProv(rpmSpec spec, Header h, rpmTag tagN, extra = Flags & _ALL_REQUIRES_MASK; } + /* rpmlib() dependency sanity: only requires permitted, ensure sense bit */ + if (rstreqn(N, "rpmlib(", sizeof("rpmlib(")-1)) { + if (nametag != RPMTAG_REQUIRENAME) return 1; + extra |= RPMSENSE_RPMLIB; + } + Flags = (Flags & RPMSENSE_SENSEMASK) | extra; if (EVR == NULL) diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 6b3d765..c7d0da3 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -343,7 +343,7 @@ Package freePackage(Package pkg); * @param EVR (e.g. Requires: foo < 0:1.2-3, "0:1.2-3") * @param Flags (e.g. Requires: foo < 0:1.2-3, both "Requires:" and "<") * @param index (0 always) - * @return 0 always + * @return 0 on success, 1 on error */ int addReqProv(rpmSpec spec, Header h, rpmTag tagN, const char * N, const char * EVR, rpmsenseFlags Flags, -- 2.7.4