]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix for registration of non-default vfs objects. (CVS 4360)
authordanielk1977 <danielk1977@noemail.net>
Sat, 1 Sep 2007 06:51:27 +0000 (06:51 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 1 Sep 2007 06:51:27 +0000 (06:51 +0000)
FossilOrigin-Name: 5f48fb95c26a713b3259ee49fd444108030376dc

main.mk
manifest
manifest.uuid
src/main.c
src/os.c
src/os_unix.c
src/test6.c
test/tclsqlite.test
test/tester.tcl

diff --git a/main.mk b/main.mk
index 7c3435ae7d0c2d7a3caa25d5d3a5622b47c2fe7a..7f2cabf98f400be5c49aefbd57f4eb9b3a46e2c4 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -301,7 +301,6 @@ objects: $(LIBOBJ_ORIG)
 # all that automatic generation.
 #
 target_source: $(SRC)
-       @echo $(SRC)
        rm -rf tsrc
        mkdir tsrc
        cp -f $(SRC) tsrc
index 113ce100d4ecc4e9384864f5a205b65503d713dc..9459cc7f0a5551c62237a37d7784d9d25a5cca5d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Fix\sa\sbug\sin\sloadext.test.\s(CVS\s4359)
-D 2007-09-01T06:19:06
+C Fix\sfor\sregistration\sof\snon-default\svfs\sobjects.\s(CVS\s4360)
+D 2007-09-01T06:51:28
 F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
 F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -63,7 +63,7 @@ F ext/icu/README.txt 3b130aa66e7a681136f6add198b076a2f90d1e33
 F ext/icu/icu.c 61a345d8126686aa3487aa8d2d0f68abd655f7a4
 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895
 F ltmain.sh 56abb507100ed2d4261f6dd1653dec3cf4066387
-F main.mk 423379cb666309af9bf7a4c9360582d2af300bc0
+F main.mk ce638342ef19844812eaade3b8a944709bb2813e
 F mkdll.sh 37fa8a7412e51b5ab2bc6d4276135f022a0feffb
 F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f
 F mkextw.sh 1a866b53637dab137191341cc875575a5ca110fb
@@ -99,7 +99,7 @@ F src/journal.c 2e0fb96d5e407a28b756b4a8b3694f2dccabe7f8
 F src/legacy.c 4ac53191fad2e3c4d59bde1228879b2dc5a96d66
 F src/limits.h 71ab25f17e35e0a9f3f6f234b8ed49cc56731d35
 F src/loadext.c 6894dbbf1666577d957922811620375d6c2f058d
-F src/main.c 00a894cd348d8d3651097bb8136f03e53afa644b
+F src/main.c c271d9104b6bff13d2ddd9a72fcf0926e635a9fd
 F src/malloc.c de4e77fe70a9a0ac47a1c3a874422b107231bf31
 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
 F src/mem1.c afe2fbf6d7e8247c6c9f69c1481358b1cad60c08
@@ -109,14 +109,14 @@ F src/mutex.h 079fa6fe9da18ceb89e79012c010594c6672addb
 F src/mutex_os2.c d47e9bd495583dd31263d8fe55160a31eb600a3c
 F src/mutex_unix.c ff77650261a245035b79c5c8a174f4e05d3cae8a
 F src/mutex_w32.c 54beb16ade8f80ea2bc30bc4dfb2087be3487ef3
-F src/os.c cc8b74355c931b360a23a8e88e07091e4baa39b8
+F src/os.c 27dea97099f9dd8d4b3fdf6177539146c6f3aeac
 F src/os.h 53e65427899ed5697d79749d646e6a297b70171a
 F src/os_common.h 98862f120ca6bf7a48ce8b16f158b77d00bc9d2f
 F src/os_os2.c 8769301bff502de642ad2634cedcb77d967ce199
 F src/os_os2.h c3f7d0af7e3453d1d7aa81b06c0a56f5a226530b
 F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
-F src/os_unix.c 4d36cd037540a9c2af540bd15ab9d2a1dcc164fe
+F src/os_unix.c 9043705193a53f9ba8aca9284b5788ce6cda0010
 F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
 F src/os_win.c ce778c06afcbfd120ede237befece4655e83c8d0
 F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
@@ -141,7 +141,7 @@ F src/test2.c 4ab230fbdc0decfa7422f6a052b609ba54f4dfac
 F src/test3.c 199a440ba2b38b26251393b609451a3484a15907
 F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071
 F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
-F src/test6.c 128084277e05073df360a030af68c22c62e19b2b
+F src/test6.c e6ce0d295f524416cb08d30c62c1fb3135962169
 F src/test7.c a9d509d0e9ad214b4772696f49f6e61be26213d1
 F src/test8.c 88e033aefdf5d5522dff46655a14ea7360fb1d26
 F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
@@ -418,9 +418,9 @@ F test/substr.test 9f26cfca74397b26ab217fb838c3d0549eb4bcf3
 F test/sync.test d05397b8f89f423dd6dba528692019ab036bc1c3
 F test/table.test dbdfd06aef054ad5aed8e57a782137d57d5c5528
 F test/tableapi.test 036575a98dcce7c92e9f39056839bbad8a715412
-F test/tclsqlite.test 3addd6a88b8a756ec802ca8840587fa3d61bfcff
+F test/tclsqlite.test a868898e3350246be7ea132621dc25f9835b3030
 F test/temptable.test c36f3e5a94507abb64f7ba23deeb4e1a8a8c3821
-F test/tester.tcl 577c2eb71a6e308f8e4d6b283c6a0d2966ed2824
+F test/tester.tcl a18c4ef2233eb87e7717b4578aef3cf6b119993c
 F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35
 F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb
 F test/threadtest1.c 6029d9c5567db28e6dc908a0c63099c3ba6c383b
@@ -568,7 +568,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 3d74256c9123e8434c68e6a0c5b61686b34a4328
-R 1c0347842404603d8a4dc887d9128ff6
+P 2be8af9d402a5cd8da8c348883188eb38900f6dc
+R 1475678fd3272d043d92d10be839de03
 U danielk1977
-Z 352000b212599994e03c0b4ef61b1896
+Z 4664902be98fc827f7437460eb18f666
index 2ba744d5df774badfff32fea08c7546c12e933d4..176f4cdfc9de1908c5e174b5a2d81f2dc155a9ae 100644 (file)
@@ -1 +1 @@
-2be8af9d402a5cd8da8c348883188eb38900f6dc
\ No newline at end of file
+5f48fb95c26a713b3259ee49fd444108030376dc
\ No newline at end of file
index a6db283520a28a3ee28b0913b1efd0acffdd76f8..803a30333d516e3cc89e545544273a51cfb1b2e5 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.401 2007/08/31 16:11:36 drh Exp $
+** $Id: main.c,v 1.402 2007/09/01 06:51:28 danielk1977 Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -950,7 +950,6 @@ static int openDatabase(
     goto opendb_out;
   }
   sqlite3_mutex_enter(db->mutex);
-  db->pVfs = sqlite3_vfs_find(zVfs);
   db->errMask = 0xff;
   db->priorNewRowid = 0;
   db->nDb = 2;
@@ -971,6 +970,14 @@ static int openDatabase(
   sqlite3HashInit(&db->aModule, SQLITE_HASH_STRING, 0);
 #endif
 
+  db->pVfs = sqlite3_vfs_find(zVfs);
+  if( !db->pVfs ){
+    rc = SQLITE_ERROR;
+    db->magic = SQLITE_MAGIC_CLOSED;
+    sqlite3Error(db, rc, "no such vfs: %s", (zVfs?zVfs:"(null)"));
+    goto opendb_out;
+  }
+
   /* Add the default collation sequence BINARY. BINARY works for both UTF-8
   ** and UTF-16, so add a version for each to avoid any unnecessary
   ** conversions. The only error that can occur here is a malloc() failure.
index c1b5510978b02f29a2bc5758c008c61984f446d2..94ae12930e8eb8c8d8d8f773d43d1e66af84e7c9 100644 (file)
--- a/src/os.c
+++ b/src/os.c
@@ -224,7 +224,7 @@ int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
     vfsList = pVfs;
   }else{
     pVfs->pNext = vfsList->pNext;
-    pVfs->pNext = pVfs;
+    vfsList->pNext = pVfs;
   }
   assert(vfsList);
   sqlite3_mutex_leave(mutex);
index b74e9f1d690d2fa6855a8ad60b6b78d5405153b9..46a176182e02307b046a9b525f07e3702976cde3 100644 (file)
@@ -2568,14 +2568,20 @@ static int unixFullPathname(sqlite3_vfs *pVfs, const char *zPath, char *zOut){
 static void *unixDlOpen(sqlite3_vfs *pVfs, const char *zFilename){
   return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL);
 }
+
+/*
+** SQLite calls this function immediately after a call to unixDlSym() or
+** unixDlOpen() fails (returns a null pointer). If a more detailed error
+** message is available, it is written to zBufOut. If no error message
+** is available, zBufOut is left unmodified and SQLite uses a default
+** error message.
+*/
 static void unixDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
   char *zErr;
   enterMutex();
   zErr = dlerror();
   if( zErr ){
     sqlite3_snprintf(nBuf, zBufOut, "%s", zErr);
-  }else if(nBuf>0) {
-    zBufOut[0] = '\0';
   }
   leaveMutex();
 }
index f4b98a5fc3a29bc79f4a45e535df62c4558f5ae4..8045509bd9bab7a079ce773ba66bab51cf345cdb 100644 (file)
@@ -753,8 +753,7 @@ static int crashParamsObjCmd(
     crashVfs.mxPathname = pOriginalVfs->mxPathname;
     crashVfs.pAppData = (void *)pOriginalVfs;
     crashVfs.szOsFile = sizeof(CrashFile) + pOriginalVfs->szOsFile;
-    /* sqlite3_vfs_unregister(pOriginalVfs); */
-    sqlite3_vfs_register(&crashVfs, 1);
+    sqlite3_vfs_register(&crashVfs, 0);
   }
 
   iDc = -1;
index 158a0087d93c380874cfa21f6cd42fcca72d4b0e..8045cb8beb8027c29a93bd24e49e528b61ea775d 100644 (file)
@@ -15,7 +15,7 @@
 # interface is pretty well tested.  This file contains some addition
 # tests for fringe issues that the main test suite does not cover.
 #
-# $Id: tclsqlite.test,v 1.60 2007/08/31 14:31:45 drh Exp $
+# $Id: tclsqlite.test,v 1.61 2007/09/01 06:51:28 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -138,7 +138,10 @@ do_test tcl-1.20 {
   set v [catch {db copy} msg]
   lappend v $msg
 } {1 {wrong # args: should be "db copy CONFLICT-ALGORITHM TABLE FILENAME ?SEPARATOR? ?NULLINDICATOR?"}}
-
+do_test tcl-1.21 {
+  set v [catch {sqlite3 db2 test.db -vfs nosuchvfs} msg]
+  lappend v $msg
+} {1 {no such vfs: nosuchvfs}}
 
 catch {unset ::result}
 do_test tcl-2.1 {
index 23c9900f14794eb77bee9bd288f33eedac655b99..4fcc17a13d26c68af173ea514d06bc3724334b74 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements some common TCL routines used for regression
 # testing the SQLite library
 #
-# $Id: tester.tcl,v 1.89 2007/08/31 14:31:45 drh Exp $
+# $Id: tester.tcl,v 1.90 2007/09/01 06:51:28 danielk1977 Exp $
 
 
 set tcl_precision 15
@@ -358,7 +358,7 @@ proc crashsql {args} {
   set f [open crash.tcl w]
   puts $f "sqlite3_crashparams $blocksize $dc $crashdelay $cfile"
   puts $f "set sqlite_pending_byte $::sqlite_pending_byte"
-  puts $f "sqlite3 db test.db"
+  puts $f "sqlite3 db test.db -vfs crash"
 
   # This block sets the cache size of the main database to 10
   # pages. This is done in case the build is configured to omit