rpm/backport-Revert-back-to-implicit-database-creation-for-now.patch

50 lines
1.7 KiB
Diff

From 4d04e84ac4421bc3d9c2f9572a10c7980ff8d43f Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 26 Apr 2021 10:43:47 +0300
Subject: [PATCH] Revert back to implicit database creation for now
The implicit database creation even on read-only access is rooted so
deep in so many places that this needs more thought and saner APIs.
While creating databases on read-only access remains a crazy thing to
do, we need to have a proper solution to point people to when changing
the behavior, and right now we don't.
This effectively reverts 86f593d5135b00a9dbf7dc6d5efc8b341002aa08,
d601a7b7ae764b31ad74b2dceff1eafb5297147f and
afbc2b07839c9ffe9f274f3a4bc2395c76d65472, but adopting 4.16.x version
of the sqlite open error message to avoid accessing freed handle, and
leaving the testcase for query on non-existent db in place (just
changing the expected result) as this is a rather fundamental behavior
thing.
---
lib/depends.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/lib/depends.c b/lib/depends.c
index cae0a9a..dce614a 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -4,8 +4,6 @@
#include "system.h"
-#include <fcntl.h>
-
#include <rpm/rpmlib.h> /* rpmVersionCompare, rpmlib provides */
#include <rpm/rpmtag.h>
#include <rpm/rpmlog.h>
@@ -418,10 +416,6 @@ static int addPackage(rpmts ts, Header h,
if (isSource)
op = RPMTE_INSTALL;
- /* Ensure database creation on initial installs */
- if (!isSource && rpmtsGetDBMode(ts) == O_RDONLY)
- rpmtsSetDBMode(ts, (O_RDWR|O_CREAT));
-
/* Do lazy (readonly?) open of rpm database for upgrades. */
if (op != RPMTE_INSTALL && rpmtsGetRdb(ts) == NULL && rpmtsGetDBMode(ts) != -1) {
if ((ec = rpmtsOpenDB(ts, rpmtsGetDBMode(ts))) != 0)
--
2.27.0