Bug#776987: version string in libsqlcipher

2015-04-17 Thread Ben Carrillo
On Thu, Apr 16, 2015 at 11:32:10AM -0400, Hans-Christoph Steiner transmogrified 
1.4K bytes...

 I did just think of one last thing to check: the SO versioning of the library
 file, i.e. libsqlcipher.so
 
 Also, the public representation of the SQLCipher version, like in
 sqlcipher.pc, version the SQLite3 version.

thanks for the info hans
I believe the attached patch would be addressing these issues.
can you have a look and comment if something's missing?

maybe we should ask to re-include libsqlcipher0 in testing after this
fix?
diff -rupN ../../../tmp/sqlcipher-3.2.0/debian/patches/20-change-name-to-sqlcipher.patch patches/20-change-name-to-sqlcipher.patch
--- ../../../tmp/sqlcipher-3.2.0/debian/patches/20-change-name-to-sqlcipher.patch	2014-10-16 23:24:01.0 -0400
+++ patches/20-change-name-to-sqlcipher.patch	2015-04-17 00:21:21.808599690 -0400
@@ -1,7 +1,70 @@
 a/VERSION
-+++ b/VERSION
-@@ -1 +1 @@
--3.8.6
-\ No newline at end of file
+--- /dev/null
 b/VERSION_SQLCIPHER
+@@ -0,0 +1 @@
 +3.2.0
-\ No newline at end of file
+--- a/sqlcipher.pc.in
 b/sqlcipher.pc.in
+@@ -7,7 +7,7 @@ includedir=@includedir@
+ 
+ Name: SQLCipher
+ Description: SQL database engine
+-Version: @PACKAGE_VERSION@
++Version: @SQLCIPHER_VERSION@
+ Libs: -L${libdir} -lsqlcipher
+ Libs.private: @LIBS@
+ Cflags: -I${includedir}
+--- a/src/tclsqlite.c
 b/src/tclsqlite.c
+@@ -3080,6 +3080,10 @@ static int DbMain(void *cd, Tcl_Interp *
+ # define PACKAGE_VERSION SQLITE_VERSION
+ #endif
+ 
++#ifndef SQLCIPHER_PACKAGE_VERSION
++# define SQLCIPHER_PACKAGE_VERSION SQLCIPHER_VERSION
++#endif
++
+ /*
+ ** Initialize this module.
+ **
+--- a/Makefile.in
 b/Makefile.in
+@@ -90,6 +90,8 @@ VERSION = @VERSION@
+ VERSION_NUMBER = @VERSION_NUMBER@
+ RELEASE = @RELEASE@
+ 
++SQLCIPHER_VERSION = @SQLCIPHER_VERSION@
++
+ # Filename extensions
+ #
+ BEXE = @BUILD_EXEEXT@
+--- a/autoconf/tea/Makefile.in
 b/autoconf/tea/Makefile.in
+@@ -93,6 +93,7 @@ INSTALL_SCRIPT	= @INSTALL_SCRIPT@
+ 
+ PACKAGE_NAME	= @PACKAGE_NAME@
+ PACKAGE_VERSION	= @PACKAGE_VERSION@
++SQLCIPHER_PACKAGE_VERSION = @SQLCIPHER_PACKAGE_VERSION@
+ CC		= @CC@
+ CFLAGS_DEFAULT	= @CFLAGS_DEFAULT@
+ CFLAGS_WARNING	= @CFLAGS_WARNING@
+--- a/configure.ac
 b/configure.ac
+@@ -89,6 +89,7 @@
+ #
+ AC_INIT(sqlcipher, m4_esyscmd([cat VERSION | tr -d '\n']))
+ 
++
+ dnl Make sure the local VERSION file matches this configure script
+ sqlite_version_sanity_check=`cat $srcdir/VERSION | tr -d '\n'`
+ if test $PACKAGE_VERSION != $sqlite_version_sanity_check ; then
+@@ -179,6 +180,10 @@ VERSION_NUMBER=[`cat $srcdir/VERSION \
+ AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
+ AC_SUBST(VERSION_NUMBER)
+ 
++SQLCIPHER_VERSION=[`cat $srcdir/VERSION_SQLCIPHER | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
++AC_MSG_NOTICE(SQLCipher Version set to $SQLCIPHER_VERSION)
++AC_SUBST(SQLCIPHER_VERSION)
++
+ #
+ # Check to see if the --with-hints=FILE option is used.  If there is none,
+ # then check for a files named $host.hints and ../$hosts.hints where
diff -rupN ../../../tmp/sqlcipher-3.2.0/debian/patches/31-increase_SQLITE_MAX_DEFAULT_PAGE_SIZE_to_32k.patch patches/31-increase_SQLITE_MAX_DEFAULT_PAGE_SIZE_to_32k.patch
--- ../../../tmp/sqlcipher-3.2.0/debian/patches/31-increase_SQLITE_MAX_DEFAULT_PAGE_SIZE_to_32k.patch	2014-10-16 23:10:08.0 -0400
+++ patches/31-increase_SQLITE_MAX_DEFAULT_PAGE_SIZE_to_32k.patch	2015-04-16 23:53:25.700288317 -0400
@@ -10,8 +10,8 @@ Bug-Debian: http://bugs.debian.org/67257
 Forwarded: not-needed
 Last-Update: 2012-05-16
 
 sqlite3-3.7.12.orig/src/sqliteLimit.h
-+++ sqlite3-3.7.12/src/sqliteLimit.h
+--- a/src/sqliteLimit.h
 b/src/sqliteLimit.h
 @@ -169,7 +169,7 @@
  ** SQLite will choose on its own.
  */
diff -rupN ../../../tmp/sqlcipher-3.2.0/debian/patches/32-fix-pkgconfig-libname.patch patches/32-fix-pkgconfig-libname.patch
--- ../../../tmp/sqlcipher-3.2.0/debian/patches/32-fix-pkgconfig-libname.patch	2014-10-16 23:25:32.0 -0400
+++ patches/32-fix-pkgconfig-libname.patch	2015-04-17 00:24:08.973428615 -0400
@@ -1,7 +1,7 @@
 --- a/sqlcipher.pc.in
 +++ b/sqlcipher.pc.in
 @@ -10,4 +10,4 @@ Description: SQL database engine
- Version: @PACKAGE_VERSION@
+ Version: @SQLCIPHER_VERSION@
  Libs: -L${libdir} -lsqlcipher
  Libs.private: @LIBS@
 -Cflags: -I${includedir}


Bug#776987: version string in libsqlcipher

2015-04-16 Thread Hans-Christoph Steiner

FYI, I CC'ed the bug for the record:

Kali Kaneko:
 On Tue, Apr 07, 2015 at 02:53:59PM -0400, Hans-Christoph Steiner

 Unfortunately, I don't think it is going to be as simple as just
 removing the patch that changes VERSION to the SQLCipher version.  Some 
 places need
 the SQLite version and other places need the SQLCipher version
 
 I've been combing thru he sources, and in the source code for SQLCipher
 I don't seem to be able to find any place that's using the sqlcipher
 version for anything. crypto.h has a CYPHER_VERSION, but that's
 hardcoded, and sqlcipher.h doesn't seem to refer to any version string.
 
 The only checks for the SQLITE_VERSION_NUMBER that I see, outside of the
 test suite, seem to be in the extensions (fts and rtree):
 
 #if SQLITE_VERSION_NUMBER=3008002
 
 But this is expecting the sqlite version and not the sqlcipher one.
 
 hans, do you remember which parts of the code (or the packaging) were
 expecting the SQLCipher version?

Here's what I found, its not especially conclusive.  In Makefile.in, the value
of VERSION is used to generate sqlite3.h:

sqlite3.h:  $(TOP)/src/sqlite.h.in $(TOP)/manifest.uuid $(TOP)/VERSION
$(TCLSH_CMD) $(TOP)/tool/mksqlite3h.tcl $(TOP) sqlite3.h


in configure.ac, the value in the file VERSION is put into Makefile variables
VERSION and VERSION_NUMBER:

VERSION=[`cat $srcdir/VERSION | sed 's/^\([0-9]*\.*[0-9]*\).*/\1/'`]
AC_MSG_NOTICE(Version set to $VERSION)
AC_SUBST(VERSION)
RELEASE=`cat $srcdir/VERSION`
AC_MSG_NOTICE(Release set to $RELEASE)
AC_SUBST(RELEASE)
VERSION_NUMBER=[`cat $srcdir/VERSION \
   | sed 's/[^0-9]/ /g' \
| awk '{printf %d%03d%03d,$1,$2,$3}'`]
AC_MSG_NOTICE(Version number set to $VERSION_NUMBER)
AC_SUBST(VERSION_NUMBER)


in tool/mksqlite3h.tcl, it is parsed into zVersion and nVersion, which then
does replacements in src/sqlite.h.in:

set in [open $TOP/VERSION]
set zVersion [string trim [read $in]]
close $in
set nVersion [eval format %d%03d%03d [split $zVersion .]]

...

regsub -- --VERS--   $line $zVersion line
regsub -- --VERSION-NUMBER-- $line $nVersion line

But it seems that it might be that all those machinations end up with really
only SQLITE_VERSION_NUMBER being set in a way that we have to think about.

.hc





signature.asc
Description: OpenPGP digital signature


Bug#776987: version string in libsqlcipher

2015-04-16 Thread Hans-Christoph Steiner

I did just think of one last thing to check: the SO versioning of the library
file, i.e. libsqlcipher.so

Also, the public representation of the SQLCipher version, like in
sqlcipher.pc, version the SQLite3 version.

.hc



signature.asc
Description: OpenPGP digital signature