From 422abdab3263df6ecf211ff86e046af7132bab25 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: May 12 2020 09:56:04 +0000 Subject: Fix segfault when trying to use unknown database backend --- diff --git a/0001-Fix-regression-causing-segfault-on-database-autodete.patch b/0001-Fix-regression-causing-segfault-on-database-autodete.patch new file mode 100644 index 0000000..bf46531 --- /dev/null +++ b/0001-Fix-regression-causing-segfault-on-database-autodete.patch @@ -0,0 +1,29 @@ +From 853c48ba6468ce1a516621a2fa6d1fc51e4f7410 Mon Sep 17 00:00:00 2001 +Message-Id: <853c48ba6468ce1a516621a2fa6d1fc51e4f7410.1589277227.git.pmatilai@redhat.com> +From: Panu Matilainen +Date: Thu, 2 Apr 2020 09:14:36 +0300 +Subject: [PATCH] Fix regression causing segfault on database autodetection + +If configuration points to non-existent backend, tryBackend() will +segfault on the first call. Duh. Regression introduced in commit +3eb0eed3806b41efdf86f0433d0b5d7d6c953561. +--- + lib/backend/dbi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/backend/dbi.c b/lib/backend/dbi.c +index b51fc7ba3..94823b14c 100644 +--- a/lib/backend/dbi.c ++++ b/lib/backend/dbi.c +@@ -52,7 +52,7 @@ dbiIndex dbiNew(rpmdb rdb, rpmDbiTagVal rpmtag) + static int tryBackend(const char *dbhome, const struct rpmdbOps_s *be) + { + int rc = 0; +- if (be->path) { ++ if (be && be->path) { + char *path = rstrscat(NULL, dbhome, "/", be->path, NULL); + rc = (access(path, F_OK) == 0); + free(path); +-- +2.26.2 + diff --git a/rpm.spec b/rpm.spec index cd7bd1a..4f69c25 100644 --- a/rpm.spec +++ b/rpm.spec @@ -25,7 +25,7 @@ %global rpmver 4.15.90 %global snapver git14971 -%global rel 11 +%global rel 12 %global srcver %{rpmver}%{?snapver:-%{snapver}} %global srcdir %{?snapver:testing}%{!?snapver:rpm-%(echo %{rpmver} | cut -d'.' -f1-2).x} @@ -64,6 +64,7 @@ Patch101: 0001-rpmfc-Do-not-prepend-buildroot-to-a-path-for-paramet.patch Patch102: 0001-Fix-regression-causing-all-ELF-files-classified-as-O.patch Patch103: 0001-Warn-on-undefined-components-in-buildtree-macros.patch Patch104: 0001-Don-t-look-into-source-package-provides-in-depsolvin.patch +Patch105: 0001-Fix-regression-causing-segfault-on-database-autodete.patch # These are not yet upstream Patch906: rpm-4.7.1-geode-i686.patch @@ -551,6 +552,9 @@ fi %doc doc/librpm/html/* %changelog +* Tue May 12 2020 Panu Matilainen - 4.15.90-0.git14971.12 +- Fix segfault when trying to use unknown database backend + * Thu May 7 2020 Panu Matilainen - 4.15.90-0.git14971.11 - Flag BDB databases for rebuild on next reboot whenever rpm is updated - Switch default database to sqlite (#1818910)