Hi,

This patch is taken from Debian's subversion packaging.  It avoids
having to rebuild Subversion each time an older or newer patchlevel of
SQLite gets installed (i.e., the x in 3.7.x changes).  I'd appreciate
any thoughts you have.

Thanks,
Jonathan

[[[
The actual ABI compatibility of sqlite3 doesn't depend on the patchlevel
(the x in 3.7.x), so stop being picky about the patchlevel when checking
the version number at runtime.  This avoids spurious errors of the form
"svn: Couldn't perform atomic initialization" / "svn: SQLite compiled
for 3.7.4, but running with 3.7.3" when sqlite gets a minor update
without Subversion being rebuilt to match.

* subversion/libsvn_subr/sqlite.c
  (init_sqlite): Omit the patchlevel in version number sanity check.
  (svn_sqlite__open): Include compatibility code for running against
   libsqlite 3.7.7 even when built against a later version.

Patch by: peters
(Tweaked by me to be cautious about SQLITE_VERSION_AT_LEAST checks.)

Found by: Joao Palhoto Matos <joao.palh...@gmail.com>
http://bugs.debian.org/608925
]]]

Index: subversion/libsvn_subr/sqlite.c
===================================================================
--- subversion/libsvn_subr/sqlite.c     (revision 1194866)
+++ subversion/libsvn_subr/sqlite.c     (working copy)
@@ -606,7 +606,7 @@ static volatile svn_atomic_t sqlite_init_state = 0
 static svn_error_t *
 init_sqlite(void *baton, apr_pool_t *pool)
 {
-  if (sqlite3_libversion_number() < SQLITE_VERSION_NUMBER)
+  if (sqlite3_libversion_number()/1000 < SQLITE_VERSION_NUMBER/1000)
     {
       return svn_error_createf(
                     SVN_ERR_SQLITE_ERROR, NULL,
@@ -772,7 +772,7 @@ svn_sqlite__open(svn_sqlite__db_t **db, const char
    */
   {
     int ignored_err = SQLITE_OK;
-#if !SQLITE_VERSION_AT_LEAST(3,7,8) && defined(SQLITE_SCHEMA)
+#if defined(SQLITE_SCHEMA)
     if (!strcmp(sqlite3_libversion(), "3.7.7"))
       ignored_err = SQLITE_SCHEMA;
 #endif

Reply via email to