diff --git a/0001-Fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH-from-.patch b/0001-Fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH-from-.patch new file mode 100644 index 0000000..d268354 --- /dev/null +++ b/0001-Fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH-from-.patch @@ -0,0 +1,42 @@ +From b89d65e5ca0552b2a33db7c82d72cfc81677588d Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Tue, 19 Sep 2017 09:56:36 +0200 +Subject: [PATCH] Fall back to DB_PRIVATE on DB_VERSION_MISMATCH from rpmdb + open + +This happens when libdb or glibc gets updated in the transaction so +its version appears newer than the currently used one requiring libdb +to reconstruct its environment, but the environment is in use by the +running transaction so it can't do that. Since libsolv only opens +it for reading, DB_PRIVATE is the lesser evil compared to just failing. +Also print out a diagnostic so we don't need to keep guessing whether +the fix is in place or not. dbenv->errx() needs to be used for the +message to get through in the right context, fprintf() get either eaten +or printed long after the fact. +--- + ext/repo_rpmdb.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c +index ceaf351..a0140a0 100644 +--- a/ext/repo_rpmdb.c ++++ b/ext/repo_rpmdb.c +@@ -1247,7 +1247,14 @@ opendbenv(struct rpmdbstate *state) + { + #if defined(FEDORA) || defined(MAGEIA) + int serialize_fd = serialize_dbenv_ops(state); +- r = dbenv->open(dbenv, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 0644); ++ int eflags = DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL; ++ r = dbenv->open(dbenv, dbpath, eflags, 0644); ++ if (r == DB_VERSION_MISMATCH) ++ { ++ eflags |= DB_PRIVATE; ++ dbenv->errx(dbenv, "warning: DB_VERSION_MISMATCH, retrying with DB_PRIVATE"); ++ r = dbenv->open(dbenv, dbpath, eflags, 0644); ++ } + if (serialize_fd >= 0) + close(serialize_fd); + #else +-- +2.15.0 + diff --git a/0001-fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH.patch b/0001-fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH.patch deleted file mode 100644 index d1f38b1..0000000 --- a/0001-fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH.patch +++ /dev/null @@ -1,31 +0,0 @@ -From a7adb20f24a3acc4cd300b9fb12e07ee3dcfb8e3 Mon Sep 17 00:00:00 2001 -From: Panu Matilainen -Date: Tue, 19 Sep 2017 09:56:36 +0200 -Subject: [PATCH] fall back to DB_PRIVATE on DB_VERSION_MISMATCH - ---- - ext/repo_rpmdb.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c -index c7000a9..85e327c 100644 ---- a/ext/repo_rpmdb.c -+++ b/ext/repo_rpmdb.c -@@ -1246,7 +1246,13 @@ opendbenv(struct rpmdbstate *state) - { - #if defined(FEDORA) || defined(MAGEIA) - int serialize_fd = serialize_dbenv_ops(state); -- r = dbenv->open(dbenv, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 0644); -+ int eflags = DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL; -+ r = dbenv->open(dbenv, dbpath, eflags, 0644); -+ if (r == DB_VERSION_MISMATCH) -+ { -+ eflags |= DB_PRIVATE; -+ r = dbenv->open(dbenv, dbpath, eflags, 0644); -+ } - if (serialize_fd >= 0) - close(serialize_fd); - #else --- -2.14.1 - diff --git a/libsolv.spec b/libsolv.spec index bbfa49b..a518cc5 100644 --- a/libsolv.spec +++ b/libsolv.spec @@ -38,14 +38,14 @@ Name: lib%{libname} Version: 0.6.30 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Package dependency solver License: BSD URL: https://github.com/openSUSE/libsolv Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz # https://bugzilla.redhat.com/show_bug.cgi?id=1483553 -Patch0: 0001-fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH.patch +Patch0: 0001-Fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH-from-.patch BuildRequires: cmake BuildRequires: gcc-c++ @@ -288,6 +288,9 @@ popd %endif %changelog +* Mon Nov 06 2017 Panu Matilainen - 0.6.30-2 +- Better error message on DB_VERSION_MISMATCH errors + * Tue Oct 24 2017 Igor Gnatenko - 0.6.30-1 - Update to 0.6.30