public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: Band-aid for DB_VERSION_MISMATCH errors on glibc updates (#1465809)
Date: Mon, 23 Nov 2026 09:31:30 GMT [thread overview]
Message-ID: <179542629063.1.6425395355902590903.rpms-rpm-fefe4f03a3e1@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : fefe4f03a3e18dc609883944d0b150bf5cc95a3c
Author : Panu Matilainen <pmatilai@redhat.com>
Date : 2017-08-28T19:39:24+03:00
Stats : +102/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/fefe4f03a3e18dc609883944d0b150bf5cc95a3c?branch=pmatilai-v6
Log:
Band-aid for DB_VERSION_MISMATCH errors on glibc updates (#1465809)
---
diff --git a/rpm-4.13.90-db-version-mismatch.patch b/rpm-4.13.90-db-version-mismatch.patch
new file mode 100644
index 0000000..60698d3
--- /dev/null
+++ b/rpm-4.13.90-db-version-mismatch.patch
@@ -0,0 +1,97 @@
+From 70a1efa52b2c442308fd1ddfd706770b6515a2c5 Mon Sep 17 00:00:00 2001
+Message-Id: <70a1efa52b2c442308fd1ddfd706770b6515a2c5.1503938132.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 28 Aug 2017 18:56:04 +0300
+Subject: [PATCH 1/3] Limit automatic fallback to DB_PRIVATE to read-only
+ operations
+
+Only permit automatic fallback to the essentially lockless operation
+of DB_PRIVATE when read-only database is requested. This isn't exactly
+correct, as readers need locks for correct operation just like writers do,
+but at least in the readonly case the database wont be damaged.
+
+The exception to the rule is systems which don't support the shared mapping
+at all so we don't have much choice. Explicitly configured
+I-know-what-I'm-doing DB_PRIVATE is not affected either.
+---
+ lib/backend/db3.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/lib/backend/db3.c b/lib/backend/db3.c
+index 26013bfa0..89d14a878 100644
+--- a/lib/backend/db3.c
++++ b/lib/backend/db3.c
+@@ -407,6 +407,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
+ int rc, xx;
+ int retry_open = 2;
+ int lockfd = -1;
++ int rdonly = ((rdb->db_mode & O_ACCMODE) == O_RDONLY);
+ struct dbConfig_s * cfg = &rdb->cfg;
+ /* This is our setup, thou shall not have other setups before us */
+ uint32_t eflags = (DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB);
+@@ -476,7 +477,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
+ */
+ if (!(eflags & DB_PRIVATE)) {
+ lockfd = serialize_env(dbhome);
+- if (lockfd < 0) {
++ if (lockfd < 0 && rdonly) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+ rpmlog(RPMLOG_DEBUG, "serialize failed, using private dbenv\n");
+@@ -494,7 +495,10 @@ static int db_init(rpmdb rdb, const char * dbhome)
+ free(fstr);
+
+ rc = (dbenv->open)(dbenv, dbhome, eflags, rdb->db_perms);
+- if ((rc == EACCES || rc == EROFS) || (rc == EINVAL && errno == rc)) {
++ if (rc == EINVAL && errno == rc) {
++ eflags |= DB_PRIVATE;
++ retry_open--;
++ } else if (rdonly && (rc == EACCES || rc == EROFS)) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+ } else {
+--
+2.13.5
+
+From 2822ccbcdf3e898b960fafb23c4d571e26cef0a4 Mon Sep 17 00:00:00 2001
+Message-Id: <2822ccbcdf3e898b960fafb23c4d571e26cef0a4.1503938132.git.pmatilai@redhat.com>
+In-Reply-To: <70a1efa52b2c442308fd1ddfd706770b6515a2c5.1503938132.git.pmatilai@redhat.com>
+References: <70a1efa52b2c442308fd1ddfd706770b6515a2c5.1503938132.git.pmatilai@redhat.com>
+From: Panu Matilainen <pmatilai@redhat.com>
+Date: Mon, 28 Aug 2017 19:17:24 +0300
+Subject: [PATCH 2/3] Fallback to DB_PRIVATE on readonly DB_VERSION_MISMATCH
+ too (RhBug:1465809)
+
+All these years BDB has been relying on undefined behavior by storing
+POSIX thread objects in its persistent environment files (for the long
+story, see RhBug:1394862). As a side-effect of fixing it in BDB,
+all sorts of creatures from dark corners are getting dragged into
+the daylight: rawhide glibc gets updated a lot and we're getting
+DB_VERSION_MISMATCH hits from rpm queries from package scriptlets
+(told you so...), other tools not closing their database handles
+when they should etc etc. This lets those cases continue "working"
+to the extent they always did (ie unreliably) for now.
+
+We should log some diagnostic message in this case, but coming up
+with an understandable and reasonably short message for this mess
+isn't that easy :)
+---
+ lib/backend/db3.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/backend/db3.c b/lib/backend/db3.c
+index 89d14a878..da50dfda4 100644
+--- a/lib/backend/db3.c
++++ b/lib/backend/db3.c
+@@ -498,7 +498,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
+ if (rc == EINVAL && errno == rc) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+- } else if (rdonly && (rc == EACCES || rc == EROFS)) {
++ } else if (rdonly && (rc == EACCES || rc == EROFS || rc == DB_VERSION_MISMATCH)) {
+ eflags |= DB_PRIVATE;
+ retry_open--;
+ } else {
+--
+2.13.5
+
diff --git a/rpm.spec b/rpm.spec
index ed53299..032580c 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -37,7 +37,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}7%{?dist}
+Release: %{?snapver:0.%{snapver}.}8%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2
@@ -67,6 +67,7 @@ Patch7: rpm-4.13.90-macro-noquote.patch
# Patches already upstream:
Patch100: rpm-4.13.90-silent-lookup.patch
+Patch101: rpm-4.13.90-db-version-mismatch.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@@ -633,6 +634,9 @@ make check
%doc doc/librpm/html/*
%changelog
+* Mon Aug 28 2017 Panu Matilainen <pmatilai@redhat.com> - 4.13.90-0.git14000.8
+- Band-aid for DB_VERSION_MISMATCH errors on glibc updates (#1465809)
+
* Thu Aug 24 2017 Panu Matilainen <pmatilai@redhat.com> - 4.13.90-0.git14000.7
- Remove ugly kludges from posttrans script, BDB handles this now
reply other threads:[~2026-11-23 9:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542629063.1.6425395355902590903.rpms-rpm-fefe4f03a3e1@fedoraproject.org \
--to=pmatilai@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox