From: Michael Schroeder Date: Tue, 7 Jun 2016 08:55:50 +0000 (+0200) Subject: Fix bug in ignoreinst logic X-Git-Tag: 0.6.22~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f92572e8b38598a9a40bffecccb27018932330b4;p=thirdparty%2Flibsolv.git Fix bug in ignoreinst logic The old code did not work if there was exactly one ignoreinst candidate. --- diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 92aef31a..94450235 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -55,7 +55,8 @@ /* 4: fixed triggers */ /* 5: fixed checksum copying */ /* 6: add SOLVABLE_PREREQ_IGNOREINST support */ -#define RPMDB_COOKIE_VERSION 6 +/* 7: fix bug in ignoreinst logic */ +#define RPMDB_COOKIE_VERSION 7 #define TAG_NAME 1000 #define TAG_VERSION 1001 @@ -588,18 +589,23 @@ makedeps(Pool *pool, Repo *repo, RpmHead *rpmhead, int tagn, int tagv, int tagf, solv_free(n); solv_free(v); solv_free(f); - if (has_ign && ignq->count > 2) + if (ignq && ignq->count) { - Id id, lastid = 0; - int j; - - solv_sort(ignq->elements, ignq->count / 2, sizeof(Id) * 2, ignq_sortcmp, 0); - for (i = j = 0; i < ignq->count; i += 2) + int j = 0; + if (has_ign && ignq->count == 2) + j = 1; + else if (has_ign) { - id = ignq->elements[i]; - if (id != lastid && ignq->elements[i + 1] > 0) - ignq->elements[j++] = id; - lastid = id; + Id id, lastid = 0; + + solv_sort(ignq->elements, ignq->count / 2, sizeof(Id) * 2, ignq_sortcmp, 0); + for (i = j = 0; i < ignq->count; i += 2) + { + id = ignq->elements[i]; + if (id != lastid && ignq->elements[i + 1] > 0) + ignq->elements[j++] = id; + lastid = id; + } } queue_truncate(ignq, j); }