From 39022028e91c1692d10b8564382963e3be0a8b17 Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Sun, 26 Sep 2021 13:42:54 +0200 Subject: [PATCH] db: Ensure sqlite3 library minimum version and major version match We were really strict with the version check, requiring an exact match. We now check that we are running at least with the version we were compiled with (distro upgrades continue to work, and repro builds are built off of an unupdated installation matching this minimum requirement), and a major version match (since major versions can and will introduce breaking changes). Changelog-Fixed: sqlite3: Relaxed the version match requirements to be at least a minimum version and a major version match --- tools/headerversions.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/headerversions.c b/tools/headerversions.c index 4ecf937c5..5e0056be5 100644 --- a/tools/headerversions.c +++ b/tools/headerversions.c @@ -31,9 +31,14 @@ static const char template[] = "{\n" " char compiled_gmp_version[100];\n" IF_SQLITE3( - " if (SQLITE_VERSION_NUMBER != sqlite3_libversion_number())\n" + " /* Require at least the version we compiled with. */" + " if (SQLITE_VERSION_NUMBER > sqlite3_libversion_number())\n" " errx(1, \"SQLITE version mismatch: compiled %%u, now %%u\",\n" " SQLITE_VERSION_NUMBER, sqlite3_libversion_number());\n" + " /* Ensure the major version matches. */" + " if (SQLITE_VERSION_NUMBER + 1000000 < sqlite3_libversion_number())\n" + " errx(1, \"SQLITE major version mismatch: compiled %%u, now %%u\",\n" + " SQLITE_VERSION_NUMBER, sqlite3_libversion_number());\n" ) " /* zlib documents that first char alters ABI. Kudos! */\n" " if (zlibVersion()[0] != ZLIB_VERSION[0])\n"