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
This commit is contained in:
Christian Decker 2021-09-26 13:42:54 +02:00 committed by Rusty Russell
parent be3eaa475c
commit 39022028e9

View file

@ -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"