]> git.pld-linux.org Git - packages/rpm.git/blame - sqlite-log-crash.patch
make -lib depend on elfutils-libs instead of elfutils; rel 7
[packages/rpm.git] / sqlite-log-crash.patch
CommitLineData
c53f303b
JP
1From ea3187cfcf9cac87e5bc5e7db79b0338da9e355e Mon Sep 17 00:00:00 2001
2From: Panu Matilainen <pmatilai@redhat.com>
3Date: Mon, 26 Jun 2023 12:45:09 +0300
4Subject: [PATCH] Don't muck with per-process global sqlite configuration from
5 the db backend
6
7sqlite3_config() affects all in-process uses of sqlite. librpm being a
8low-level library, it has no business whatsoever making such decisions
9for the applications running on top of it. Besides that, the callback can
10easily end up pointing to an already closed database, causing an
11innocent API user to crash in librpm on an entirely unrelated error on
12some other database. "Oops."
13
14The sqlite API doesn't seem to provide any per-db or non-global context
15for logging errors, thus we can only remove the call and let sqlite output
16errors the way it pleases (print through stderr, presumably).
17
18Thanks to Jan Palus for spotting and reporting!
19---
20 lib/backend/sqlite.c | 8 --------
21 1 file changed, 8 deletions(-)
22
23diff --git a/lib/backend/sqlite.c b/lib/backend/sqlite.c
24index 5a029d575a..b612732267 100644
25--- a/lib/backend/sqlite.c
26+++ b/lib/backend/sqlite.c
27@@ -44,13 +44,6 @@ static void rpm_match3(sqlite3_context *sctx, int argc, sqlite3_value **argv)
28 sqlite3_result_int(sctx, match);
29 }
30
31-static void errCb(void *data, int err, const char *msg)
32-{
33- rpmdb rdb = data;
34- rpmlog(RPMLOG_WARNING, "%s: %s: %s\n",
35- rdb->db_descr, sqlite3_errstr(err), msg);
36-}
37-
38 static int dbiCursorReset(dbiCursor dbc)
39 {
40 if (dbc->stmt) {
41@@ -170,7 +163,6 @@ static int sqlite_init(rpmdb rdb, const char * dbhome)
42 * the "database is locked" errors at every cost
43 */
44 sqlite3_busy_timeout(sdb, 10000);
45- sqlite3_config(SQLITE_CONFIG_LOG, errCb, rdb);
46
47 sqlexec(sdb, "PRAGMA secure_delete = OFF");
48 sqlexec(sdb, "PRAGMA case_sensitive_like = ON");
This page took 0.085918 seconds and 4 git commands to generate.