diff --git a/lib/rpmte.c b/lib/rpmte.c index 9325d21fa..9e4db2c3a 100644 --- a/lib/rpmte.c +++ b/lib/rpmte.c @@ -57,6 +57,7 @@ struct rpmte_s { fnpyKey key; /*!< (TR_ADDED) Retrieval key. */ rpmRelocation * relocs; /*!< (TR_ADDED) Payload file relocations. */ int nrelocs; /*!< (TR_ADDED) No. of relocations. */ + uint8_t *badrelocs; /*!< (TR_ADDED) Bad relocations (or NULL) */ FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */ #define RPMTE_HAVE_PRETRANS (1 << 0) @@ -178,8 +179,9 @@ static void buildRelocs(rpmte p, Header h, rpmRelocation *relocs) } if (!valid) { - rpmteAddProblem(p, RPMPROB_BADRELOCATE, NULL, - p->relocs[i].oldPath, 0); + if (p->badrelocs == NULL) + p->badrelocs = xcalloc(p->nrelocs, sizeof(*p->badrelocs)); + p->badrelocs[i] = 1; } } else { p->relocs[i].newPath = NULL; @@ -228,6 +230,7 @@ static int addTE(rpmte p, Header h, fnpyKey key, rpmRelocation * relocs) p->nrelocs = 0; p->relocs = NULL; + p->badrelocs = NULL; if (relocs != NULL) buildRelocs(p, h, relocs); @@ -298,6 +301,7 @@ rpmte rpmteFree(rpmte te) free(te->relocs[i].newPath); } free(te->relocs); + free(te->badrelocs); } free(te->os); @@ -841,6 +845,18 @@ void rpmteAddDepProblem(rpmte te, const char * altNEVR, rpmds ds, } } +void rpmteAddRelocProblems(rpmte te) +{ + if (te && te->badrelocs) { + for (int i = 0; i < te->nrelocs; i++) { + if (te->badrelocs[i]) { + rpmteAddProblem(te, RPMPROB_BADRELOCATE, NULL, + te->relocs[i].oldPath, 0); + } + } + } +} + const char * rpmteTypeString(rpmte te) { switch(rpmteType(te)) { diff --git a/lib/rpmte_internal.h b/lib/rpmte_internal.h index 8a8df2a8b..66f9788cb 100644 --- a/lib/rpmte_internal.h +++ b/lib/rpmte_internal.h @@ -66,6 +66,9 @@ RPM_GNUC_INTERNAL void rpmteAddDepProblem(rpmte te, const char * pkgNEVR, rpmds ds, fnpyKey * suggestedKeys); +RPM_GNUC_INTERNAL +void rpmteAddRelocProblems(rpmte te); + RPM_GNUC_INTERNAL const char * rpmteTypeString(rpmte te); diff --git a/lib/transaction.c b/lib/transaction.c index 46999d42a..9a7e4a283 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -1045,6 +1045,9 @@ static rpmps checkProblems(rpmts ts) } rpmdbFreeIterator(mi); } + + if (!(probFilter & RPMPROB_FILTER_FORCERELOCATE)) + rpmteAddRelocProblems(p); } rpmtsiFree(pi); return rpmtsProblems(ts);