------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-C Bug\sfix:\s\sOnly\strust\sthe\sdatabase\ssize\snumber\sat\soffset\s28\sif\sthe\schange\ncounter\sat\soffset\s24\smatches\sthe\sversion\snumber\scounter\sat\soffset\s92.\nThis\sprevents\scorruption\sin\sthe\scase\sof\stwo\sapplications\swriting\sto\sthe\ndatabase\swhere\sone\sis\san\solder\sversion\sof\sSQLite\sand\sthe\sother\sis\sa\snewer\nversion.
-D 2010-06-17T02:13:40
+C Add\stest\scase\sfor\s[fc62af4523].
+D 2010-06-17T10:24:28
F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
F Makefile.in a5cad1f8f3e021356bfcc6c77dc16f6f1952bbc3
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F test/tkt-d82e3f3721.test 731359dfdcdb36fea0559cd33fec39dd0ceae8e6
F test/tkt-f777251dc7a.test 6f24c053bc5cdb7e1e19be9a72c8887cf41d5e87
F test/tkt-f973c7ac31.test 1da0ed15ec2c7749fb5ce2828cd69d07153ad9f4
+F test/tkt-fc62af4523.test 7db6d6bddcf5b2da60a7e242311fdb6f3a2d27b1
F test/tkt1435.test f8c52c41de6e5ca02f1845f3a46e18e25cadac00
F test/tkt1443.test bacc311da5c96a227bf8c167e77a30c99f8e8368
F test/tkt1444.test a9d72f9e942708bd82dde6c707da61c489e213e9
F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P ad3209572d0e6afe5c8b52313e334509661045e2
-R ad508c111bfac4ef56e6dd1a72cf9f53
-U drh
-Z 1cb6e747168ed02cf4bf3371c6ee48c5
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.6 (GNU/Linux)
-
-iD8DBQFMGYTXoxKgR168RlERAgMoAKCCbW2c14E1x3NYvkGGyBe/EgKS5QCeL5Cg
-CUKdqaE7t6fQ84lCcJEMBaQ=
-=hOmP
------END PGP SIGNATURE-----
+P f80c3f922a114e738613955a939db46cf0847038
+R f2ba6ac15d8c700b7fd50a974fe0be0f
+U dan
+Z bff60ae022798c7d58eb4dc568bf20d9
--- /dev/null
+# 2010 June 16
+#
+# 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 ticket [fc62af4523] has been resolved.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/lock_common.tcl
+source $testdir/malloc_common.tcl
+
+do_test tkt-fc62af4523.1 {
+ execsql {
+ PRAGMA cache_size = 10;
+ PRAGMA journal_mode = persist;
+ CREATE TABLE t1(a UNIQUE, b UNIQUE);
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300);
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 2
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 4
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 8
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 16
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 32
+ INSERT INTO t1 SELECT randomblob(200), randomblob(300) FROM t1; -- 64
+ }
+ execsql {
+ PRAGMA integrity_check;
+ SELECT count(*) FROM t1;
+ }
+} {ok 64}
+
+# Launch an external process. Have it write (but not commit) a large
+# transaction to the database.
+#
+set ::chan [launch_testfixture]
+proc buddy {code} { testfixture $::chan $code }
+do_test tkt-fc62af4523.2 {
+ testfixture $::chan {
+ sqlite3 db test.db
+ db eval {
+ PRAGMA cache_size = 10;
+ BEGIN;
+ UPDATE t1 SET b = randomblob(400);
+ UPDATE t1 SET a = randomblob(200);
+ }
+ }
+ file exists test.db-journal
+} {1}
+
+# Now do "PRAGMA journal_mode = DELETE" in this process. At one point
+# this was causing SQLite to delete the journal file from the file-system,
+# even though the external process is currently using it.
+#
+do_test tkt-fc62af4523.3 { execsql { PRAGMA journal_mode = DELETE } } {delete}
+do_test tkt-fc62af4523.4 { file exists test.db-journal } {1}
+
+# Cause the external process to crash. Since it has already written
+# uncommitted data into the database file, the next reader will have
+# to do a hot-journal rollback to recover the database.
+#
+# Or, if this test is run in a version with the bug present, the journal
+# file has already been deleted. In this case we are left with a corrupt
+# database file and no hot-journal to fix it with.
+#
+do_test tkt-fc62af4523.5 {
+ testfixture $::chan sqlite_abort
+} {ERROR: Child process hung up}
+after 200
+do_test tkt-fc62af4523.6 {
+ execsql {
+ PRAGMA integrity_check;
+ SELECT count(*) FROM t1;
+ }
+} {ok 64}
+
+catch { close $::chan }
+finish_test
+