File keyimportdeadlock.diff of Package python-rpm.32908
--- lib/rpmts.c.orig 2022-10-24 13:16:04.707666000 +0000
+++ lib/rpmts.c 2022-10-24 13:16:08.519657779 +0000
@@ -550,6 +550,7 @@ rpmRC rpmtsImportPubkey(const rpmts ts,
int subkeysCount = 0;
rpmVSFlags oflags = rpmtsVSFlags(ts);
rpmKeyring keyring;
+ int olddbmode = ts->rdb ? ts->dbmode : -1;
rpmtxn txn = rpmtxnBegin(ts, RPMTXN_WRITE);
int krc, i;
@@ -598,6 +599,9 @@ exit:
rpmKeyringFree(keyring);
rpmtxnEnd(txn);
+ /* close database if it is now in a different mode to prevent deadlocks */
+ if (ts->rdb && ts->dbmode != olddbmode)
+ rpmtsCloseDB(ts);
return rc;
}