|
Panu Matilainen |
75bce8 |
From ea3187cfcf9cac87e5bc5e7db79b0338da9e355e Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
75bce8 |
Message-ID: <ea3187cfcf9cac87e5bc5e7db79b0338da9e355e.1687844980.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
75bce8 |
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Panu Matilainen |
75bce8 |
Date: Mon, 26 Jun 2023 12:45:09 +0300
|
|
Panu Matilainen |
75bce8 |
Subject: [PATCH] Don't muck with per-process global sqlite configuration from
|
|
Panu Matilainen |
75bce8 |
the db backend
|
|
Panu Matilainen |
75bce8 |
|
|
Panu Matilainen |
75bce8 |
sqlite3_config() affects all in-process uses of sqlite. librpm being a
|
|
Panu Matilainen |
75bce8 |
low-level library, it has no business whatsoever making such decisions
|
|
Panu Matilainen |
75bce8 |
for the applications running on top of it. Besides that, the callback can
|
|
Panu Matilainen |
75bce8 |
easily end up pointing to an already closed database, causing an
|
|
Panu Matilainen |
75bce8 |
innocent API user to crash in librpm on an entirely unrelated error on
|
|
Panu Matilainen |
75bce8 |
some other database. "Oops."
|
|
Panu Matilainen |
75bce8 |
|
|
Panu Matilainen |
75bce8 |
The sqlite API doesn't seem to provide any per-db or non-global context
|
|
Panu Matilainen |
75bce8 |
for logging errors, thus we can only remove the call and let sqlite output
|
|
Panu Matilainen |
75bce8 |
errors the way it pleases (print through stderr, presumably).
|
|
Panu Matilainen |
75bce8 |
|
|
Panu Matilainen |
75bce8 |
Thanks to Jan Palus for spotting and reporting!
|
|
Panu Matilainen |
75bce8 |
---
|
|
Panu Matilainen |
75bce8 |
lib/backend/sqlite.c | 8 --------
|
|
Panu Matilainen |
75bce8 |
1 file changed, 8 deletions(-)
|
|
Panu Matilainen |
75bce8 |
|
|
Panu Matilainen |
75bce8 |
diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c
|
|
Panu Matilainen |
75bce8 |
index 5a029d575..b61273226 100644
|
|
Panu Matilainen |
75bce8 |
--- a/lib/backend/sqlite.c
|
|
Panu Matilainen |
75bce8 |
+++ b/lib/backend/sqlite.c
|
|
Panu Matilainen |
75bce8 |
@@ -44,13 +44,6 @@ static void rpm_match3(sqlite3_context *sctx, int argc, sqlite3_value **argv)
|
|
Panu Matilainen |
75bce8 |
sqlite3_result_int(sctx, match);
|
|
Panu Matilainen |
75bce8 |
}
|
|
Panu Matilainen |
75bce8 |
|
|
Panu Matilainen |
75bce8 |
-static void errCb(void *data, int err, const char *msg)
|
|
Panu Matilainen |
75bce8 |
-{
|
|
Panu Matilainen |
75bce8 |
- rpmdb rdb = data;
|
|
Panu Matilainen |
75bce8 |
- rpmlog(RPMLOG_WARNING, "%s: %s: %s\n",
|
|
Panu Matilainen |
75bce8 |
- rdb->db_descr, sqlite3_errstr(err), msg);
|
|
Panu Matilainen |
75bce8 |
-}
|
|
Panu Matilainen |
75bce8 |
-
|
|
Panu Matilainen |
75bce8 |
static int dbiCursorReset(dbiCursor dbc)
|
|
Panu Matilainen |
75bce8 |
{
|
|
Panu Matilainen |
75bce8 |
if (dbc->stmt) {
|
|
Panu Matilainen |
75bce8 |
@@ -170,7 +163,6 @@ static int sqlite_init(rpmdb rdb, const char * dbhome)
|
|
Panu Matilainen |
75bce8 |
* the "database is locked" errors at every cost
|
|
Panu Matilainen |
75bce8 |
*/
|
|
Panu Matilainen |
75bce8 |
sqlite3_busy_timeout(sdb, 10000);
|
|
Panu Matilainen |
75bce8 |
- sqlite3_config(SQLITE_CONFIG_LOG, errCb, rdb);
|
|
Panu Matilainen |
75bce8 |
|
|
Panu Matilainen |
75bce8 |
sqlexec(sdb, "PRAGMA secure_delete = OFF");
|
|
Panu Matilainen |
75bce8 |
sqlexec(sdb, "PRAGMA case_sensitive_like = ON");
|
|
Panu Matilainen |
75bce8 |
--
|
|
Panu Matilainen |
75bce8 |
2.41.0
|
|
Panu Matilainen |
75bce8 |
|