.gear/rules | 3 + .../tags/3f5dc0011e793fe1e42c3b1f4e008069c64c38e9 | 13 + .../tags/ae92bc4d8446a5ba99117d48c34e8a37c7ce0380 | 13 + .gear/tags/list | 3 + COPYING | 77 +++++ Makefile.in | 56 +++- configure.ac | 1 + lemon.1 | 71 +++++ libsqlite3.map | 107 +++++++ sqlite3.1 | 2 +- sqlite3.pc.in | 2 +- sqlite3.spec | 327 ++++++++++++++++++++ src/expr.c | 1 + src/os.h | 3 +- src/os_unix.c | 36 ++- src/prepare.c | 2 +- src/sqlite3ext.h | 2 +- src/sqliteInt.h | 8 + src/util.c | 3 +- test/tclsqlite.test | 6 +- test/tkt3201.test | 76 +++++ tool/lemon.c | 24 +- 22 files changed, 800 insertions(+), 36 deletions(-) diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..4cdd182 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,3 @@ +tar: @version@:. name=sqlite-@version@ +tar: doc-current:docsrc name=@name@-docsrc base=docsrc +diff: @version@:. . diff --git a/.gear/tags/3f5dc0011e793fe1e42c3b1f4e008069c64c38e9 b/.gear/tags/3f5dc0011e793fe1e42c3b1f4e008069c64c38e9 new file mode 100644 index 0000000..12c6a1f --- /dev/null +++ b/.gear/tags/3f5dc0011e793fe1e42c3b1f4e008069c64c38e9 @@ -0,0 +1,13 @@ +object 4f10c809d06d7574ad5b9df5dfff75d08f8e67c1 +type commit +tag 3.5.9 +tagger Alexey Tourbin 1211433496 +0400 + +3.5.9 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEABECAAYFAkg1AhgACgkQfBKgtDjnu0Y2+QCeLCr5OwKUEKTbxXEQlsC9yIW9 +/J4AnA9OPlxK8+WwaHpttSfmcJ+x36rd +=22eM +-----END PGP SIGNATURE----- diff --git a/.gear/tags/ae92bc4d8446a5ba99117d48c34e8a37c7ce0380 b/.gear/tags/ae92bc4d8446a5ba99117d48c34e8a37c7ce0380 new file mode 100644 index 0000000..2675901 --- /dev/null +++ b/.gear/tags/ae92bc4d8446a5ba99117d48c34e8a37c7ce0380 @@ -0,0 +1,13 @@ +object 2f2a302d8efb367bae375b7b4ef6d5946a367851 +type commit +tag 3.5.8 +tagger Alexey Tourbin 1211418660 +0400 + +3.5.8 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.9 (GNU/Linux) + +iEYEABECAAYFAkg0yCQACgkQfBKgtDjnu0bDhgCgu36SyQ5KWwzcRTStOkmgPniT +BlUAoMjrVGy9lYX6U5P++jpkc4M++hv2 +=JqM1 +-----END PGP SIGNATURE----- diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..2ce6202 --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1,3 @@ +ae92bc4d8446a5ba99117d48c34e8a37c7ce0380 3.5.8 +3f5dc0011e793fe1e42c3b1f4e008069c64c38e9 3.5.9 +ccaed632ba3c41b33377d09663a6a4551d8acf7b doc-current diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e75b15e --- /dev/null +++ b/COPYING @@ -0,0 +1,77 @@ +SQLite primary author and maintainer is D. Richard Hipp . +The author disclaims copyright to this source code. The library is in the +public domain. Here is the author statement found in the source code: + +** 2001 September 15 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. + +Another copyright statement from http://www.sqlite.org/copyright.html: + + The original author of SQLite has dedicated the code to the public domain. + Anyone is free to copy, modify, publish, use, compile, sell, or distribute + the original SQLite code, either in source code form or as a compiled binary, + for any purpose, commercial or non-commercial, and by any means. + +List of contributors, according to cvs log (see also +http://www.sqlite.org/cvstrac/userlist): + +Adam Dingle +Andreas Rottmann +Christian Werner +Dan Kennedy +Dennis Cote +Doug Currie +Doug Henry +Jim Lyon +Jonathan Adams +Kurt Welgehausen +Matthew O. Persico +Mike Cariotoglou +Paul Flinders +Peter MacDonald +Peter Weilbacher +Scott Hess +Tom Poindexter +Xuezhang Dong + +Copyright policy for contributed code, found at +http://www.sqlite.org/copyright.html: + + In order to keep SQLite complete free and unencumbered by copyright, other + contributors to the SQLite code base are asked to likewise dedicate their + contributions to the public domain. If you want to send a patch or + enhancement for possible inclusion in the SQLite source tree, please + accompany the patch with the following statement: + + The author or authors of this code dedicate any and all copyright interest + in this code to the public domain. We make this dedication for the benefit + of the public at large and to the detriment of our heirs and successors. We + intend this dedication to be an overt act of relinquishment in perpetuity + of all present and future rights this code under copyright law. + +The documentation and test code may or may not imply additional copyright +restrictions. The following notice is available at +http://www.sqlite.org/different.html: + + The source code for SQLite is in the public domain. No claim of copyright is + made on any part of the core source code. (The documentation and test code is + a different matter - some sections of documentation and test logic are + governed by open-sources licenses.) All contributors to the SQLite core + software have signed affidavits specifically disavowing any copyright + interest in the code. This means that anybody is able to legally do anything + they want with the SQLite source code. + +The SQLite executable (command line interface) of this build uses the GNU +readline library, which is subject to the GNU General Public License. However, +the SQLite library itself does not link with readline and thus is not tainted +by the GPL. + +The lemon parser generator is now maintained as part of the SQLite project. +Both the source code to lemon itself and the code that lemon generates are in +the public domain. (http://www.hwaci.com/sw/lemon/) diff --git a/Makefile.in b/Makefile.in index 7c0c37d..dc93adc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -130,6 +130,9 @@ LTLINK_EXTRAS += $(GCOV_LDFLAGS$(USE_GCOV)) prefix = @prefix@ exec_prefix = @exec_prefix@ libdir = @libdir@ +tcllibdir = @libdir@/tcl +tcldatadir = @prefix@/share/tcl +sqlite3extdir = @libdir@/sqlite3 bindir = @bindir@ includedir = @includedir@ INSTALL = @INSTALL@ @@ -322,6 +325,7 @@ TESTSRC2 = \ $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbemem.c \ $(TOP)/src/where.c \ + $(TOP)/src/main.c \ parse.c # Source code to the actual test files. @@ -386,6 +390,34 @@ HDR += \ $(TOP)/ext/fts3/fts3_hash.h \ $(TOP)/ext/fts3/fts3_tokenizer.h +FTS3_HDR = \ + $(TOP)/ext/fts3/fts3.h \ + $(TOP)/ext/fts3/fts3_hash.h \ + $(TOP)/ext/fts3/fts3_tokenizer.h + +FTS3_SRC = \ + $(TOP)/ext/fts3/fts3.c \ + $(TOP)/ext/fts3/fts3_hash.c \ + $(TOP)/ext/fts3/fts3_porter.c \ + $(TOP)/ext/fts3/fts3_tokenizer.c \ + $(TOP)/ext/fts3/fts3_tokenizer1.c + +fts3.lo: $(TOP)/ext/fts3/fts3.c $(HDR) $(FTS3_HDR) + $(LTCOMPILE) -c $< +fts3_hash.lo: $(TOP)/ext/fts3/fts3_hash.c $(HDR) $(FTS3_HDR) + $(LTCOMPILE) -c $< +fts3_porter.lo: $(TOP)/ext/fts3/fts3_porter.c $(HDR) $(FTS3_HDR) + $(LTCOMPILE) -c $< +fts3_tokenizer.lo: $(TOP)/ext/fts3/fts3_tokenizer.c $(HDR) $(FTS3_HDR) + $(LTCOMPILE) -c $< +fts3_tokenizer1.lo: $(TOP)/ext/fts3/fts3_tokenizer1.c $(HDR) $(FTS3_HDR) + $(LTCOMPILE) -c $< +fts3.la: fts3.lo fts3_hash.lo fts3_porter.lo fts3_tokenizer.lo fts3_tokenizer1.lo libsqlite3.la + $(LTLINK) -module -avoid-version -rpath $(sqlite3extdir) -o fts3.la $^ -Wl,-z,defs +fts3_install: fts3.la + $(INSTALL) -d $(DESTDIR)$(sqlite3extdir) + $(LTINSTALL) $< $(DESTDIR)$(sqlite3extdir) + # If using the amalgamation, use sqlite3.c directly to build the test # fixture. Otherwise link against libsqlite3.la. (This distinction is # necessary because the test fixture requires non-API symbols which are @@ -413,13 +445,14 @@ last_change: $(SRC) libsqlite3.la: $(LIBOBJ) $(LTLINK) -o $@ $(LIBOBJ) $(TLIBS) \ + -Wl,--version-script=libsqlite3.map -Wl,-z,defs \ ${ALLOWRELEASE} -rpath "$(libdir)" -version-info "8:6:8" libtclsqlite3.la: tclsqlite.lo libsqlite3.la - $(LTLINK) -o $@ tclsqlite.lo \ - $(LIBOBJ) @TCL_STUB_LIB_SPEC@ $(TLIBS) \ - -rpath "$(libdir)/sqlite" \ - -version-info "8:6:8" + $(LTLINK) -o $@ tclsqlite.lo libsqlite3.la \ + @TCL_STUB_LIB_SPEC@ $(LIBTCL) $(TLIBS) \ + -rpath $(tcllibdir) \ + -version-info "8:6:8" -Wl,-z,defs sqlite3$(TEXE): $(TOP)/src/shell.c libsqlite3.la sqlite3.h $(LTLINK) $(READLINE_FLAGS) \ @@ -565,7 +598,7 @@ os.lo: $(TOP)/src/os.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/os.c os_unix.lo: $(TOP)/src/os_unix.c $(HDR) - $(LTCOMPILE) -c $(TOP)/src/os_unix.c + $(LTCOMPILE) -DSQLITE3EXTDIR=\"$(sqlite3extdir)\" -c $(TOP)/src/os_unix.c os_win.lo: $(TOP)/src/os_win.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/os_win.c @@ -669,7 +702,8 @@ testfixture$(TEXE): $(TESTFIXTURE_SRC) $(LTLINK) -DTCLSH=1 -DSQLITE_TEST=1 -DSQLITE_NO_SYNC=1\ -DSQLITE_CRASH_TEST=1 \ -DSQLITE_SERVER=1 -DSQLITE_PRIVATE="" -DSQLITE_CORE $(TEMP_STORE) \ - -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) $(TLIBS) + -DSQLITE_ENABLE_FTS3 -I$(TOP)/ext/fts3 $(FTS3_SRC) \ + -o $@ $(TESTFIXTURE_SRC) -static $(LIBTCL) $(TLIBS) fulltest: testfixture$(TEXE) sqlite3$(TEXE) @@ -691,7 +725,7 @@ sqlite3_analyzer$(TEXE): $(TESTFIXTURE_SRC) $(TOP)/tool/spaceanal.tcl $(TEMP_STORE) -o $@ $(TESTFIXTURE_SRC) $(LIBTCL) -install: sqlite3$(BEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install} +install: sqlite3$(BEXE) libsqlite3.la sqlite3.h $(INSTALL) -d $(DESTDIR)$(libdir) $(LTINSTALL) libsqlite3.la $(DESTDIR)$(libdir) $(INSTALL) -d $(DESTDIR)$(bindir) @@ -703,7 +737,13 @@ install: sqlite3$(BEXE) libsqlite3.la sqlite3.h ${HAVE_TCL:1=tcl_install} $(INSTALL) -m 0644 sqlite3.pc $(DESTDIR)$(libdir)/pkgconfig; tcl_install: libtclsqlite3.la - $(TCLSH_CMD) $(TOP)/tclinstaller.tcl $(VERSION) + $(INSTALL) -d $(DESTDIR)$(tcllibdir) + $(LTINSTALL) $< $(DESTDIR)$(tcllibdir) + $(INSTALL) -d $(DESTDIR)$(tcldatadir)/sqlite3 + dlname=`. libtclsqlite3.la; echo $$dlname`; \ + loadpath=`relative $(tcllibdir)/$$dlname $(tcldatadir)/sqlite3/pkgIndex.tcl |tr / ' '`; \ + echo "package ifneeded sqlite3 $(RELEASE) [list load [file join \$$dir $$loadpath] sqlite3]" > \ + $(DESTDIR)$(tcldatadir)/sqlite3/pkgIndex.tcl clean: rm -f *.lo *.la *.o sqlite3$(TEXE) libsqlite3.la diff --git a/configure.ac b/configure.ac index 2091a92..b9e0d9d 100644 --- a/configure.ac +++ b/configure.ac @@ -612,6 +612,7 @@ AC_ARG_ENABLE(load-extension, AC_HELP_STRING([--enable-load-extension], [use_loadextension=$enableval],[use_loadextension=no]) if test "${use_loadextension}" = "yes" ; then LOADEXTENSION_FLAGS="" + AC_SEARCH_LIBS(dlopen, dl) else LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1" fi diff --git a/lemon.1 b/lemon.1 new file mode 100644 index 0000000..2595370 --- /dev/null +++ b/lemon.1 @@ -0,0 +1,71 @@ +.Dd 2002-10-04 +.Dt LEMON 1 +.Os "Debian GNU/Linux" +.\" Manual page created by Guus Sliepen +.Sh NAME +.Nm lemon +.Nd The Lemon Parser Generator +.Sh SYNOPSIS +.Nm +.Op Fl bcgmqsx +.Ar input +.Sh DESCRIPTION +.Nm +is an LALR(1) parser generator for C or C++. +It does the same job as bison and yacc. +But +.Nm +is not another bison or yacc clone. +It uses a different grammar syntax which is designed to reduce the number of coding errors. +.Nm +also uses a more sophisticated parsing engine that is faster than yacc and bison +and which is both reentrant and thread-safe. +Furthermore, +.Nm +implements features that can be used to eliminate resource leaks, +making is suitable for use in long-running programs such as graphical user interfaces or embedded controllers. +.Pp +.Nm +will read the grammer from +.Ar input +and write out a parser for that grammar in the C language. +.Sh OPTIONS +.Bl -tag -width indent +.It Fl b +Print only the basis in report. +.It Fl c +Don't compress the action table. +.It Fl g +Print grammar without actions. +.It Fl m +Output a makeheaders compatible file. +.It Fl q +(Quiet) Don't print the report file. +.It Fl s +Print parser stats to standard output. +.It Fl x +Print the version number. +.El +.Sh FILES +.Bl -tag -width indent +.It Pa /usr/share/lemon/lempar.c +Driver template for the +.Nm +parser generator. +.El +.Sh SEE ALSO +/usr/share/doc/lemon/lemon.html +.Sh AUTHOR +.Nm +has been written by +.An D. Richard Hipp Aq drh@hwaci.com . +.Pp +This manual page was written by +.An Guus Sliepen Aq guus@debian.org +for the Debian GNU/Linux system. +.Sh COPYRIGHT +Both the source code to +.Nm +itself and the code that +.Nm +generates are in the public domain. diff --git a/libsqlite3.map b/libsqlite3.map new file mode 100644 index 0000000..4f4125c --- /dev/null +++ b/libsqlite3.map @@ -0,0 +1,107 @@ +SQLITE_3.2.2 { + global: + sqlite3_db_handle; + sqlite3_get_autocommit; + sqlite3_transfer_bindings; + local: + sqlite3[^_]*; + [^s]*; +}; +SQLITE_3.2.6 { + global: + sqlite3_profile; +}; +SQLITE_3.3.0 { + global: + sqlite3_enable_shared_cache; + sqlite3_rollback_hook; + sqlite3_update_hook; +}; +SQLITE_3.3.1 { + global: + sqlite3_thread_cleanup; +}; +SQLITE_3.3.4 { + global: + sqlite3_value_numeric_type; +}; +SQLITE_3.3.7 { + global: + sqlite3_bind_value; + sqlite3_clear_bindings; + sqlite3_column_value; + sqlite3_create_module; + sqlite3_declare_vtab; + sqlite3_enable_load_extension; + sqlite3_load_extension; + sqlite3_malloc; + sqlite3_realloc; + sqlite3_sleep; +}; +SQLITE_3.3.8 { + global: + sqlite3_apis; + sqlite3_auto_extension; + sqlite3_extended_result_codes; + sqlite3_overload_function; + sqlite3_reset_auto_extension; +}; +SQLITE_3.3.9 { + global: + sqlite3_prepare16_v2; + sqlite3_prepare_v2; +}; +SQLITE_3.4.0 { + global: + sqlite3_bind_zeroblob; + sqlite3_blob_bytes; + sqlite3_blob_close; + sqlite3_blob_open; + sqlite3_blob_read; + sqlite3_blob_write; + sqlite3_create_collation_v2; + sqlite3_result_error_toobig; + sqlite3_result_zeroblob; +}; +SQLITE_3.4.1 { + sqlite3_create_module_v2; +}; +SQLITE_3.5.0 { + global: + sqlite3_file_control; + sqlite3_memory_alarm; + sqlite3_memory_highwater; + sqlite3_memory_used; + sqlite3_mutex_alloc; + sqlite3_mutex_enter; + sqlite3_mutex_free; + sqlite3_mutex_leave; + sqlite3_mutex_try; + sqlite3_open_v2; + sqlite3_release_memory; + sqlite3_result_error_nomem; + sqlite3_soft_heap_limit; + sqlite3_threadsafe; + sqlite3_vfs_find; + sqlite3_vfs_register; + sqlite3_vfs_unregister; +}; +SQLITE_3.5.3 { + global: + sqlite3_sql; +}; +SQLITE_3.5.5 { + global: + sqlite3_test_control; +}; +SQLITE_3.5.6 { + global: + sqlite3_result_error_code; +}; +SQLITE_3.5.8 { + global: + sqlite3_context_db_handle; + sqlite3_limit; + sqlite3_randomness; +}; +/* the prefix is SQLITE_, not SQLITE3_ */ diff --git a/sqlite3.1 b/sqlite3.1 index 785995b..745a424 100644 --- a/sqlite3.1 +++ b/sqlite3.1 @@ -222,7 +222,7 @@ o All other command line options are processed. .SH SEE ALSO http://www.sqlite.org/ .br -The sqlite-doc package +The sqlite3-doc package .SH AUTHOR This manual page was originally written by Andreas Rottmann , for the Debian GNU/Linux system (but may be used diff --git a/sqlite3.pc.in b/sqlite3.pc.in index 50bf996..c8d0aa9 100644 --- a/sqlite3.pc.in +++ b/sqlite3.pc.in @@ -7,7 +7,7 @@ includedir=@includedir@ Name: SQLite Description: SQL database engine -Version: @VERSION@ +Version: @RELEASE@ Libs: -L${libdir} -lsqlite3 Libs.private: @LIBS@ Cflags: -I${includedir} diff --git a/sqlite3.spec b/sqlite3.spec new file mode 100644 index 0000000..707456f --- /dev/null +++ b/sqlite3.spec @@ -0,0 +1,327 @@ +Name: sqlite3 +Version: 3.5.9 +Release: alt2.M41.1 + +Summary: An Embeddable SQL Database Engine +License: Public Domain +Group: Development/Databases + +URL: http://www.sqlite.org/ +Source0: sqlite-%version.tar +Source1: %name-docsrc.tar +Patch: %name-%version-%release.patch + +Requires: lib%name = %version-%release + +# Automatically added by buildreq on Sat May 24 2008 +BuildRequires: gcc-c++ gcc-fortran libreadline-devel tcl-devel + +%package -n lib%name +Summary: An Embeddable SQL Database Engine (shared library) +Group: System/Libraries + +%package -n lib%name-devel +Summary: An Embeddable SQL Database Engine (header files) +Group: Development/Databases +Requires: lib%name = %version-%release + +%package -n lib%name-devel-static +Summary: An Embeddable SQL Database Engine (static library) +Group: Development/Databases +Requires: lib%name-devel = %version-%release + +%package tcl +Summary: An Embeddable SQL Database Engine (TCL bindings) +Group: Development/Tcl +Requires: lib%name = %version-%release + +%package fts3 +Summary: Full Text Search backend for the SQLite database engine +Group: Development/Databases +Requires: lib%name = %version-%release + +%package doc +Summary: An Embeddable SQL Database Engine (documentation) +Group: Development/Documentation +Conflicts: %name < 3.3.8-alt1 +BuildArch: noarch + +%package -n lemon +Summary: The Lemon Parser Generator +Group: Development/Other + +%description +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +%description -n lib%name +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +%description -n lib%name-devel +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +%description -n lib%name-devel-static +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +%description tcl +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +%description fts3 +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +The fts3 loadable module implements full text search, see +http://www.sqlite.org/cvstrac/wiki?p=FtsOne +http://www.sqlite.org/cvstrac/wiki?p=FtsTwo + +%description doc +SQLite is a C library that implements an SQL database engine. +Programs that link with the SQLite library can have SQL database +access without running a separate RDBMS process. + +%description -n lemon +Lemon is an LALR(1) parser generator for C or C++. It does the same +job as bison and yacc. But lemon is not another bison or yacc +clone. It uses a different grammar syntax which is designed to reduce +the number of coding errors. Lemon also uses a more sophisticated +parsing engine that is faster than yacc and bison and which is both +reentrant and thread-safe. Furthermore, Lemon implements features +that can be used to eliminate resource leaks, making is suitable for +use in long-running programs such as graphical user interfaces or +embedded controllers. + +%prep +%setup -q -n sqlite-%version -a1 +%patch -p1 +rm aclocal.m4 config.guess config.sub configure ltmain.sh + +%build +autoreconf -i +# maybe add -lhistory; cf. [devel] libreadline add_history +%configure --enable-threadsafe --enable-readline --with-readline-lib=-lreadline --disable-amalgamation --enable-load-extension +%make_build all libtcl%name.la fts3.la + +make -C docsrc DOC=. SRC=.. + +%def_with test +%if_with test +# XXX src/main.c leaks due to SQLITE_ENABLE_FTS3 +rm -fv test/malloc6.test test/mallocG.test +make test +%endif + +%install +%make_install install tcl_install fts3_install DESTDIR=%buildroot +install -pD -m644 %name.1 %buildroot%_man1dir/%name.1 + +install -pD -m755 lemon %buildroot%_bindir/lemon +install -pD -m644 lemon.1 %buildroot%_man1dir/lemon.1 +install -pD -m644 lempar.c %buildroot%_datadir/lemon/lempar.c + +%define pkgdocdir %_docdir/sqlite-3.5 +install -pD -m644 COPYING %buildroot%pkgdocdir/COPYING +cp -a docsrc/doc %buildroot%pkgdocdir/html +install -pD -m644 doc/lemon.html %buildroot%_docdir/lemon/lemon.html + +%post -n lib%name -p %post_ldconfig +%postun -n lib%name -p %postun_ldconfig + +%files +%_bindir/%name +%_man1dir/%name.* + +%files -n lib%name +%_libdir/lib%name.so.?* +%dir %pkgdocdir +%pkgdocdir/COPYING + +%files -n lib%name-devel +%_includedir/sqlite3.h +%_includedir/sqlite3ext.h +%_libdir/lib%name.so +#_libdir/lib%name.la +%_pkgconfigdir/%name.pc + +%files -n lib%name-devel-static +%_libdir/lib%name.a + +%files tcl +%_tcllibdir/libtcl%name.so* +#_tcllibdir/libtcl%name.a +#_tcllibdir/libtcl%name.la +%dir %_tcldatadir/sqlite3 +%_tcldatadir/sqlite3/pkgIndex.tcl + +%files fts3 +%dir %_libdir/sqlite3 +%_libdir/sqlite3/fts3.so +#_libdir/sqlite3/fts3.a +#_libdir/sqlite3/fts3.la + +%files doc +%dir %pkgdocdir +%pkgdocdir/html + +%files -n lemon +%_bindir/lemon +%_man1dir/lemon.* +%_datadir/lemon/ +%dir %_docdir/lemon +%_docdir/lemon/lemon.html + +%changelog +* Wed Nov 05 2008 Alexey Tourbin 3.5.9-alt2.M41.1 +- rebuilt for branch 4.1 + +* Sun Oct 12 2008 Alexey Tourbin 3.5.9-alt3 +- backported from cvs: + + fix for DISTINCT on indexes (RH#463061, deb#500792) + + improved NaN testing for highly optimized GCC on x86 (deb#488864) + + tclsqlite.test works reliably with tcl 8.5.4 +- set correct version in pkgIndex.tcl (deb#483990) + +* Fri Jul 04 2008 Alexey Tourbin 3.5.9-alt2 +- sqlite3.pc: provide full version (#16268) +- made sqlite3-doc package noarch + +* Sat May 24 2008 Alexey Tourbin 3.5.9-alt1 +- 3.4.2 -> 3.5.9 +- upgraded fts2 subpackage to fts2 +- merged new documentation from http://sqlite.org/docsrc/ + +* Fri Aug 17 2007 Alexey Tourbin 3.4.2-alt1 +- 3.4.1+cvs20070803 -> 3.4.2 + +* Sun Aug 05 2007 Alexey Tourbin 3.4.1-alt2 +- 3.4.1+cvs20070720 -> 3.4.1+cvs20070803 + +* Sat Jul 21 2007 Alexey Tourbin 3.4.1-alt1 +- 3.3.17+ -> 3.4.1+cvs20070720 (fixes multiple vulnerabilities + discovered by the Google Security team) +- changed src.rpm packaging to keep separate tarball with cvs snapshot + +* Fri Apr 27 2007 Alexey Tourbin 3.3.17-alt1 +- 3.3.15 -> 3.3.17+ + +* Tue Apr 10 2007 Alexey Tourbin 3.3.15-alt1 +- 3.3.14+ -> 3.3.15 +- re-enabled exclusive2.test + +* Tue Apr 03 2007 Alexey Tourbin 3.3.14-alt1 +- 3.3.13+ -> 3.3.14+ +- disabled -fno-strict-aliasing since the code has been fixed +- disabled exclusive2.test and types3.test + +* Tue Feb 20 2007 Alexey Tourbin 3.3.13-alt1 +- 3.3.12 -> 3.3.13+ + +* Sun Jan 28 2007 Alexey Tourbin 3.3.12-alt1 +- 3.3.11 -> 3.3.12 + +* Tue Jan 23 2007 Alexey Tourbin 3.3.11-alt1 +- 3.3.10+ -> 3.3.11 +- sqlite3-doc: packaged missing html files + +* Thu Jan 11 2007 Alexey Tourbin 3.3.10-alt1 +- 3.3.8+ -> 3.3.10+ + +* Wed Nov 15 2006 Alexey Tourbin 3.3.8-alt2 +- 3.3.8+ cvs snapshot +- enabled full text search backend (sqlite3-fts2 package) + +* Sat Oct 21 2006 Alexey Tourbin 3.3.8-alt1 +- imported cvs sources with git-cvsimport; applied my changes + to the source tree and built with gear +- this release is based on sqlite version 3.3.8 +- changed documentation packaging: introduced sqlite3-doc package; moved + lemon.html to lemon package; added COPYING, which was compiled from + various sources; sqlite is still public domain, with a few minor issues + +* Sun Aug 13 2006 Alexey Tourbin 3.3.7-alt1 +- 3.3.6 -> 3.3.7 + +* Wed Jun 07 2006 Alexey Tourbin 3.3.6-alt1 +- 3.3.5 -> 3.3.6 +- compiled with -fno-strict-aliasing (debian #364196) +- linked libtclsqlite3.so with libtcl.so + +* Sun Apr 16 2006 Alexey Tourbin 3.3.5-alt1 +- 3.3.4 -> 3.3.5; sync debian sqlite3_3.3.5-0.1 +- urgency=high (for lib%name >= 3.3): hacked sqlite3_prepare() to keep + old code work; try "sqlite3_prepare nBytes" web search for details +- restricted list of symbols exported by the library; + introduced symbol versioning +- fixed libtcl%name linkage (eliminated internal lib%name copy) +- improved temporary file handling +- new package: lemon (LALR parser generator) + +* Thu Mar 09 2006 Denis Smirnov 3.3.4-alt1 +- 3.2.6 -> 3.3.4 + +* Fri Dec 30 2005 ALT QA Team Robot 3.2.6-alt1.1 +- Rebuilt with libreadline.so.5. + +* Sat Sep 24 2005 Alexey Tourbin 3.2.6-alt1 +- 3.2.5 -> 3.2.6; urgency=medium + +* Mon Aug 29 2005 Alexey Tourbin 3.2.5-alt1 +- 3.2.2 -> 3.2.5 + +* Fri Jun 24 2005 Alexey Tourbin 3.2.2-alt1 +- 3.2.1 -> 3.2.2 +- enabled thread-safety (--enable-threadsafe configure option) +- removed --enable-utf8 configure option (has no effect) + +* Wed Apr 06 2005 Alexey Tourbin 3.2.1-alt1 +- 3.1.3 -> 3.2.1 + +* Fri Mar 04 2005 Alexey Tourbin 3.1.3-alt1 +- 3.0.8 -> 3.1.3 + +* Fri Nov 26 2004 Alexey Tourbin 3.0.8-alt1.1 +- fixed tcl bindings (patch by Sergey Bolshakov) + +* Thu Oct 21 2004 Alexey Tourbin 3.0.8-alt1 +- 3.0.6 -> 3.0.8 +- alt-makefile.patch merged upstream (sqlite ticket #903 for `mkdir -p', + sqlite ticket #904 for libdir/lib64) +- added post/postun ldconfig scripts + +* Thu Sep 16 2004 Alexey Tourbin 3.0.6-alt1 +- 3.0.4 -> 3.0.6 +- hopefully should build on x86_64 + +* Fri Aug 13 2004 Alexey Tourbin 3.0.4-alt1 +- 2.8.13 -> 3.0.4 (beta), renamed to sqlite3 + +* Fri Jun 04 2004 Denis Smirnov 2.8.13-alt4 +- Rebuild + +* Thu Jun 03 2004 Denis Smirnov 2.8.13-alt2 +- Fix for correcting update + +* Mon May 31 2004 Denis Smirnov 2.8.13-alt1 +- Some minor packaging fixes +- Tcl binding bugfix + +* Sun Apr 11 2004 Denis Smirnov 2.8.5-alt3 +- Tcl binding build + +* Sat Dec 13 2003 Ott Alex 2.8.5-alt2 +- Remove .la files + +* Sun Jul 27 2003 Ott Alex 2.8.5-alt1 +- New version + +* Tue Jul 22 2003 Ott Alex 2.8.4-alt1 +- Initial build diff --git a/src/expr.c b/src/expr.c index 5421b51..bb49465 100644 --- a/src/expr.c +++ b/src/expr.c @@ -3428,6 +3428,7 @@ int sqlite3GetTempReg(Parse *pParse){ } void sqlite3ReleaseTempReg(Parse *pParse, int iReg){ if( iReg && pParse->nTempRegaTempReg) ){ + sqlite3ExprWritableRegister(pParse, iReg, iReg); pParse->aTempReg[pParse->nTempReg++] = iReg; } } diff --git a/src/os.h b/src/os.h index ac619af..c3dc01e 100644 --- a/src/os.h +++ b/src/os.h @@ -87,7 +87,8 @@ # include # define SQLITE_TEMPNAME_SIZE (CCHMAXPATHCOMP) #else -# define SQLITE_TEMPNAME_SIZE 200 +# include +# define SQLITE_TEMPNAME_SIZE PATH_MAX #endif /* If the SET_FULLSYNC macro is not defined above, then make it diff --git a/src/os_unix.c b/src/os_unix.c index f5bc490..bb14fed 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -2407,6 +2407,11 @@ static int unixOpen( if( isReadonly ) oflags |= O_RDONLY; if( isReadWrite ) oflags |= O_RDWR; if( isCreate ) oflags |= O_CREAT; +#ifdef O_NOATIME + if( isDelete ) oflags |= O_NOATIME; +#else +#warning "O_NOATIME not defined" +#endif if( isExclusive ) oflags |= (O_EXCL|O_NOFOLLOW); oflags |= (O_LARGEFILE|O_BINARY); @@ -2495,12 +2500,10 @@ static int unixAccess(sqlite3_vfs *pVfs, const char *zPath, int flags){ ** pVfs->mxPathname bytes. */ static int unixGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ - static const char *azDirs[] = { - 0, - "/var/tmp", - "/usr/tmp", + const char *azDirs[] = { + sqlite3_temp_directory, + __secure_getenv("TMPDIR"), "/tmp", - ".", }; static const unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz" @@ -2516,9 +2519,8 @@ static int unixGetTempname(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ */ SimulateIOError( return SQLITE_ERROR ); - azDirs[0] = sqlite3_temp_directory; for(i=0; i static void *unixDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ - return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL); + void *h; + char *path = NULL; + if (strchr(zFilename, '/')) + sqlite3SetString(&path, zFilename, NULL); + else { +#ifndef SQLITE3EXTDIR +#warning "Using default SQLITE3EXTDIR." +#define SQLITE3EXTDIR "/usr/local/lib/sqlite3" +#endif + const char prefix[] = SQLITE3EXTDIR "/"; + const char suffix[] = ".so"; + if (strchr(zFilename, '.')) + sqlite3SetString(&path, prefix, zFilename, NULL); + else + sqlite3SetString(&path, prefix, zFilename, suffix, NULL); + } + h = dlopen(path, RTLD_NOW); + sqlite3_free(path); + return h; } /* diff --git a/src/prepare.c b/src/prepare.c index ff340ab..a42e034 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -552,7 +552,7 @@ static int sqlite3Prepare( memset(&sParse, 0, sizeof(sParse)); sParse.db = db; - if( nBytes>=0 && zSql[nBytes-1]!=0 ){ + if( nBytes>0 && zSql[nBytes-1]!=0 ){ char *zSqlCopy; int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; if( nBytes>mxLen ){ diff --git a/src/sqlite3ext.h b/src/sqlite3ext.h index 0aadb5f..6845ef9 100644 --- a/src/sqlite3ext.h +++ b/src/sqlite3ext.h @@ -298,7 +298,7 @@ struct sqlite3_api_routines { #define sqlite3_rollback_hook sqlite3_api->rollback_hook #define sqlite3_set_authorizer sqlite3_api->set_authorizer #define sqlite3_set_auxdata sqlite3_api->set_auxdata -#define sqlite3_snprintf sqlite3_api->snprintf +#define sqlite3_snprintf (sqlite3_api->snprintf) #define sqlite3_step sqlite3_api->step #define sqlite3_table_column_metadata sqlite3_api->table_column_metadata #define sqlite3_thread_cleanup sqlite3_api->thread_cleanup diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 8649df4..e00e5f3 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -166,9 +166,17 @@ ** ** See also ticket #2741. */ +#if 0 #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && SQLITE_THREADSAFE # define _XOPEN_SOURCE 500 /* Needed to enable pthread recursive mutexes */ #endif +#endif + +#ifndef _XOPEN_SOURCE +#ifndef _GNU_SOURCE +#define _GNU_SOURCE /* ALT: also grab O_NOATIME flag */ +#endif +#endif #if defined(SQLITE_TCL) || defined(TCLSH) # include diff --git a/src/util.c b/src/util.c index 1dc2af1..998481e 100644 --- a/src/util.c +++ b/src/util.c @@ -35,7 +35,8 @@ int sqlite3IsNaN(double x){ ** rules/specifications for math functions. */ volatile double y = x; - return x!=y; + volatile double z = y; + return y!=z; } /* diff --git a/test/tclsqlite.test b/test/tclsqlite.test index 2cbbf2d..7a479b5 100644 --- a/test/tclsqlite.test +++ b/test/tclsqlite.test @@ -233,13 +233,13 @@ ifcapable {tclvar} { do_test tcl-5.1 { execsql {CREATE TABLE t3(a,b,c)} catch {unset x} - set x(1) 5 - set x(2) 7 + set x(1) A + set x(2) B execsql { INSERT INTO t3 VALUES($::x(1),$::x(2),$::x(3)); SELECT * FROM t3 } - } {5 7 {}} + } {A B {}} do_test tcl-5.2 { execsql { SELECT typeof(a), typeof(b), typeof(c) FROM t3 diff --git a/test/tkt3201.test b/test/tkt3201.test new file mode 100644 index 0000000..2d992e3 --- /dev/null +++ b/test/tkt3201.test @@ -0,0 +1,76 @@ +# 2008 July 4 +# +# The author disclaims copyright to this source code. In place of +# a legal notice, here is a blessing: +# +# May you do good and not evil. +# May you find forgiveness for yourself and forgive others. +# May you share freely, never taking more than you give. +# +#*********************************************************************** +# This file implements regression tests for SQLite library. +# Specifically, it tests that bug #3201 has been fixed. +# +# $Id$ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +do_test tkt3201-1 { + execsql { + CREATE TABLE t1(a INTEGER PRIMARY KEY, b TEXT); + INSERT INTO t1 VALUES(1, 'one'); + INSERT INTO t1 VALUES(2, 'two'); + } +} {} + +do_test tkt3201-2 { + execsql { + SELECT l.a, r.a FROM t1 AS l, t1 AS r WHERE l.a < r.a; + } +} {1 2} + +do_test tkt3201-3 { + execsql { + CREATE TABLE t2(a INTEGER PRIMARY KEY, b TEXT); + INSERT INTO t2 VALUES(2, 'two'); + } + execsql { + SELECT l.a, r.a FROM t1 AS l, t2 AS r WHERE l.a < r.a; + } +} {1 2} + +do_test tkt3201-4 { + execsql { + DELETE FROM t1 WHERE a = 2; + } + execsql { + SELECT l.a, r.a FROM t1 AS l, t2 AS r WHERE l.a < r.a; + } +} {1 2} + +do_test tkt3201-5 { + execsql { + DELETE FROM t1 WHERE a = 2; + } + execsql { + SELECT t1.a, t1.b, t2.a, t2.b FROM t1, t2; + } +} {1 one 2 two} + +do_test tkt3201-6 { + execsql { + CREATE TABLE t3(c INTEGER PRIMARY KEY, d TEXT); + INSERT INTO t3 VALUES(2, 'two'); + } + execsql { SELECT a, b, c, d FROM t1, t3 } +} {1 one 2 two} + +do_test tkt3201-7 { + explain { SELECT a, b, c, d FROM t1, t3 WHERE a < c } + execsql { SELECT a, b, c, d FROM t1, t3 WHERE a < c } +} {1 one 2 two} + +finish_test + + diff --git a/tool/lemon.c b/tool/lemon.c index 7dcbe6c..c63ad3c 100644 --- a/tool/lemon.c +++ b/tool/lemon.c @@ -1316,15 +1316,15 @@ void ErrorMsg(const char *filename, int lineno, const char *format, ...){ va_start(ap, format); /* Prepare a prefix to be prepended to every output line */ if( lineno>0 ){ - sprintf(prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); + snprintf(prefix,sizeof prefix,"%.*s:%d: ",PREFIXLIMIT-10,filename,lineno); }else{ - sprintf(prefix,"%.*s: ",PREFIXLIMIT-10,filename); + snprintf(prefix,sizeof prefix,"%.*s: ",PREFIXLIMIT-10,filename); } prefixsize = strlen(prefix); availablewidth = LINEWIDTH - prefixsize; /* Generate the error message */ - vsprintf(errmsg,format,ap); + vsnprintf(errmsg,sizeof errmsg,format,ap); va_end(ap); errmsgsize = strlen(errmsg); /* Remove trailing '\n's from the error message. */ @@ -2894,7 +2894,7 @@ struct lemon *lemp; while( cfp ){ char buf[20]; if( cfp->dot==cfp->rp->nrhs ){ - sprintf(buf,"(%d)",cfp->rp->index); + snprintf(buf,sizeof buf,"(%d)",cfp->rp->index); fprintf(fp," %5s ",buf); }else{ fprintf(fp," "); @@ -2960,7 +2960,7 @@ int modemask; c = *cp; *cp = 0; path = (char *)malloc( strlen(argv0) + strlen(name) + 2 ); - if( path ) sprintf(path,"%s/%s",argv0,name); + if( path ) snprintf(path,sizeof path,"%s/%s",argv0,name); *cp = c; }else{ extern char *getenv(); @@ -2973,7 +2973,7 @@ int modemask; if( cp==0 ) cp = &pathlist[strlen(pathlist)]; c = *cp; *cp = 0; - sprintf(path,"%s/%s",pathlist,name); + snprintf(path,sizeof path,"%s/%s",pathlist,name); *cp = c; if( c==0 ) pathlist = ""; else pathlist = &cp[1]; @@ -3053,14 +3053,16 @@ struct lemon *lemp; cp = strrchr(lemp->filename,'.'); if( cp ){ - sprintf(buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); + snprintf(buf,sizeof buf,"%.*s.lt",(int)(cp-lemp->filename),lemp->filename); }else{ - sprintf(buf,"%s.lt",lemp->filename); + snprintf(buf,sizeof buf,"%s.lt",lemp->filename); } if( access(buf,004)==0 ){ tpltname = buf; }else if( access(templatename,004)==0 ){ tpltname = templatename; + }else if( access("/usr/share/lemon/lempar.c",004)==0 ){ + tpltname = "/usr/share/lemon/lempar.c"; }else{ tpltname = pathsearch(lemp->argv0,templatename,0); } @@ -3072,7 +3074,7 @@ struct lemon *lemp; } in = fopen(tpltname,"rb"); if( in==0 ){ - fprintf(stderr,"Can't open the template file \"%s\".\n",templatename); + fprintf(stderr,"Can't open the template file \"%s\".\n",tpltname); lemp->errorcnt++; return 0; } @@ -3805,7 +3807,7 @@ int mhflag; /* Output in makeheaders format if true */ /* Generate a table containing the symbolic name of every symbol */ for(i=0; insymbol; i++){ - sprintf(line,"\"%s\",",lemp->symbols[i]->name); + snprintf(line,sizeof line,"\"%s\",",lemp->symbols[i]->name); fprintf(out," %-15s",line); if( (i&3)==3 ){ fprintf(out,"\n"); lineno++; } } @@ -3951,7 +3953,7 @@ struct lemon *lemp; in = file_open(lemp,".h","rb"); if( in ){ for(i=1; interminal && fgets(line,LINESIZE,in); i++){ - sprintf(pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); + snprintf(pattern,sizeof pattern,"#define %s%-30s %2d\n",prefix,lemp->symbols[i]->name,i); if( strcmp(line,pattern) ) break; } fclose(in);