diff --git a/3001-avoid-dead-loop-in-db3_dbiOpen-when-db_create-failed.patch b/3001-avoid-dead-loop-in-db3_dbiOpen-when-db_create-failed.patch new file mode 100644 index 0000000000000000000000000000000000000000..a17a373f74491cf9cb967a6ad77398d4415f12e6 --- /dev/null +++ b/3001-avoid-dead-loop-in-db3_dbiOpen-when-db_create-failed.patch @@ -0,0 +1,26 @@ +From b361ad80a41a07c62fc8f21cda534b35c971ace7 Mon Sep 17 00:00:00 2001 +From: Chunmei Xu +Date: Wed, 6 Sep 2023 11:11:11 +0800 +Subject: [PATCH] avoid dead loop in db3_dbiOpen when db_create failed + +Signed-off-by: Chunmei Xu +--- + lib/backend/db3.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/backend/db3.c b/lib/backend/db3.c +index da50dfd..24fbe00 100644 +--- a/lib/backend/db3.c ++++ b/lib/backend/db3.c +@@ -899,6 +899,8 @@ static int db3_dbiOpen(rpmdb rdb, rpmDbiTagVal rpmtag, dbiIndex * dbip, int flag + db->close(db, 0); + db = NULL; + } ++ } else { ++ retry_open--; + } + } + +-- +2.39.3 + diff --git a/rpm.spec b/rpm.spec index f476cd3beca0d8d5f5cdd815ac897110ac458e6c..2196c24365a71c88f17598b908a5b89276c882ac 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,4 +1,5 @@ -%define anolis_release .0.3 +%define anolis_release .0.4 + %define _legacy_common_support 1 # build against xz? %bcond_without xz @@ -23,7 +24,8 @@ # build with readonly sqlite support? %bcond_without sqlite # build with bdb_ro support? -%bcond_without bdb_ro +# if enabled, rpmdb is switched to sqlite +%bcond_with bdb_ro %if 0%{?rhel} > 7 || 0%{?anolis} # Disable python2 build by default @@ -155,12 +157,14 @@ Patch1001: compile-with-Platform-Python-binary-where-relevant.patch # make unversioned %%__python an error unless explicitly overridden Patch1002: rpm-4.14.2-unversioned-python.patch -%ifarch loongarch64 Patch2000: 1000-rpm-anolis-support-loongarch.patch Patch2001: 0001-debugedit-add-loongarch-support.patch -%endif -Patch2002: 0001-support-sqlite-backend-rpmdb.patch +# bugfix for anolis +Patch3001: 3001-avoid-dead-loop-in-db3_dbiOpen-when-db_create-failed.patch + +# defined as source file to seperate with other patches +Source1000: 0001-support-sqlite-backend-rpmdb.patch # Partially GPL/LGPL dual-licensed and some bits with BSD # SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD @@ -443,6 +447,10 @@ Obsoletes: fapolicyd-dnf-plugin %prep %autosetup -n %{name}-%{srcver} %{?with_int_bdb:-a 1} -p1 +%if %{with bdb_ro} +patch -p1 < %{SOURCE1000} +%endif + %if %{with int_bdb} ln -s db-%{bdbver} db %endif @@ -566,6 +574,7 @@ chmod a-x $RPM_BUILD_ROOT/%{rpmhome}/python-macro-helper make check || cat tests/rpmtests.log %endif +%if %{with bdb_ro} %pre # Only update if [ $1 == 2 ] @@ -577,6 +586,7 @@ fi %posttrans [ -e /var/lib/rpm/.rpm.lock ] && rm -f /var/lib/rpm/.rpm.lock rpm -q rpm 2>&1 | grep bdb && rpmdb --rebuilddb +%endif %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig @@ -723,6 +733,10 @@ rpm -q rpm 2>&1 | grep bdb && rpmdb --rebuilddb %doc doc/librpm/html/* %changelog +* Thu Sep 07 2023 Chunmei Xu - 4.14.4-26.0.4 +- avoid dead loop in db3_dbiOpen when db_create failed +- do not switch rpmdb to sqlite + * Tue Jul 25 2023 Liwei Ge - 4.14.4-26.0.3 - conditional set relbuf for loongarch debugedit