]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Integrated proxy locking file support for WAL journal mode and double free fix
authoradam <adam@noemail.net>
Tue, 9 Nov 2010 00:43:59 +0000 (00:43 +0000)
committeradam <adam@noemail.net>
Tue, 9 Nov 2010 00:43:59 +0000 (00:43 +0000)
FossilOrigin-Name: fd4d38fa66de85676189ff4922fb1bf5f8cac9c4

13 files changed:
manifest
manifest.uuid
src/main.c
src/os_unix.c
test/fallocate.test
test/lock6.test
test/lock_proxy.test
test/pager1.test
test/pragma.test
test/tester.tcl
test/wal3.test
test/walmode.test
test/walshared.test

index 0ed77208485498bf749df23349a841bc48415a39..62cf24b18e3d4417f1549f585991dd8b6c111be2 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C fixed\smemory\sleak\sin\sproxy\slock\sfile\serror\shandling
-D 2010-09-10T23:16:17
+C Integrated\sproxy\slocking\sfile\ssupport\sfor\sWAL\sjournal\smode\sand\sdouble\sfree\sfix
+D 2010-11-09T00:43:59
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in c58f7d37ad0f9b28655ba4e28c6cb0f879569cd7
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -138,7 +138,7 @@ F src/journal.c 552839e54d1bf76fb8f7abe51868b66acacf6a0e
 F src/legacy.c 015826a958f690302d27e096a68d50b3657e4201
 F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e
 F src/loadext.c 6d422ea91cf3d2d00408c5a8f2391cd458da85f8
-F src/main.c 414f59006f66a665169327700ceb27c2fd0e7c72
+F src/main.c 79573a52c9746bdc3e7942e0127556fa39cdbae5
 F src/malloc.c 19a468460c7df72de245f10c06bd0625777b7c83
 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645
 F src/mem1.c 0f36f1eecd786240924a56f8796ffa850d47a96f
@@ -157,7 +157,7 @@ F src/os.c 60178f518c4d6c0dcb59f7292232281d7bea2dcf
 F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f
 F src/os_os2.c 72d0b2e562952a2464308c4ce5f7913ac10bef3e
-F src/os_unix.c e10e9f086dcf83b6a7cb997edd97a1e3edb92f44
+F src/os_unix.c 79cf726c9a0bcc4691a01389031513c10bf15bed
 F src/os_win.c 51cb62f76262d961ea4249489383d714501315a7
 F src/pager.c a5f5d9787b11dfb0b6082e6f5846d00b459a8e19
 F src/pager.h ef8c8f71ab022cc2fff768a1175dd32355be9dcd
@@ -356,7 +356,7 @@ F test/exclusive.test 9e62270fdf967870921053e2ec0f293b67c140a4
 F test/exclusive2.test fcbb1c9ca9739292a0a22a3763243ad6d868086b
 F test/exec.test e949714dc127eaa5ecc7d723efec1ec27118fdd7
 F test/expr.test 9f521ae22f00e074959f72ce2e55d46b9ed23f68
-F test/fallocate.test 43dc34b8c24be6baffadc3b4401ee15710ce83c6
+F test/fallocate.test a9927b638567e2e776c112f54d701402a0e74023
 F test/filectrl.test 97003734290887566e01dded09dc9e99cb937e9e
 F test/filefmt.test f77c92141960b7933bc6691631d2ad62257ef40a
 F test/fkey1.test 01c7de578e11747e720c2d9aeef27f239853c4da
@@ -492,10 +492,10 @@ F test/lock2.test 5242d8ac4e2d59c403aebff606af449b455aceff
 F test/lock3.test f271375930711ae044080f4fe6d6eda930870d00
 F test/lock4.test c82268c031d39345d05efa672f80b025481b3ae5
 F test/lock5.test d0d313f059ae5661726d3f197ba6ed8f69257d8e
-F test/lock6.test b3cb49eec15cfcd6573b0a52b032046066f12114
+F test/lock6.test 55bbfce7a6905be8282f125c2dbeb8688e2cfd8b
 F test/lock7.test 64006c84c1c616657e237c7ad6532b765611cf64
 F test/lock_common.tcl 18c637fc89e12f1ac0d27d2186f12c3d3f789e3e
-F test/lock_proxy.test 9ea4307b186949fcfd012e4cd44149d2b6360da6
+F test/lock_proxy.test 95be9c32d79be25cf643b4e41a0aa0e53aa21621
 F test/lookaside.test 382e7bc2fab23d902c8eafb1b9ed7ababfff75a6
 F test/main.test 753e2b772c041bd8dbd17c7e4132b3981378eaab
 F test/make-where7.tcl 05c16b5d4f5d6512881dfec560cb793915932ef9
@@ -545,7 +545,7 @@ F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a
 F test/notnull.test cc7c78340328e6112a13c3e311a9ab3127114347
 F test/null.test a8b09b8ed87852742343b33441a9240022108993
 F test/openv2.test af02ed0a9cbc0d2a61b8f35171d4d117e588e4ec
-F test/pager1.test 3c43e01a1daa7a843b8be832b87e719363f585f2
+F test/pager1.test 4d3bf78c043af2054cfb63897ef3f990a420c6a5
 F test/pager2.test 0fbb6b6dc40ce1fecfe758c555a748ad2e9beaa3
 F test/pager3.test 3856d9c80839be0668efee1b74811b1b7f7fc95f
 F test/pagerfault.test f168ec2c659faccffc083ec1847bf4295dd67d14
@@ -555,7 +555,7 @@ F test/pagesize.test 76aa9f23ecb0741a4ed9d2e16c5fa82671f28efb
 F test/pcache.test 4118a183908ecaed343a06fcef3ba82e87e0129d
 F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16
 F test/permutations.test 17498d1219f922d5a6da893a94c4dc7766fb2426
-F test/pragma.test 68abf5033386f89a873e066360e568de8f4c0b29
+F test/pragma.test 90f2386eba9785875dc19c6c464106ad7cca12c1
 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47
 F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea
 F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301
@@ -627,7 +627,7 @@ F test/tclsqlite.test 8c154101e704170c2be10f137a5499ac2c6da8d3
 F test/tempdb.test 285dda9fdf10730702549e8aa19c9258bbf753b8
 F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a
 F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05
-F test/tester.tcl f0dd6c80ec062e2d1a76b8b21ecff36ade1e4a2d
+F test/tester.tcl e4bed769a9e7b55d569fe90e9548fc86d405acf8
 F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f
 F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db
 F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca
@@ -791,7 +791,7 @@ F test/vtab_err.test 0d4d8eb4def1d053ac7c5050df3024fd47a3fbd8
 F test/vtab_shared.test 0eff9ce4f19facbe0a3e693f6c14b80711a4222d
 F test/wal.test d83c3d227e9e9bb5c7a0c1447ea4a3c6cd5fced4
 F test/wal2.test 998e1807c7bea96f1a5246adf670d02137118339
-F test/wal3.test 2bc5bed33ba16db805ee00185c083a7c24070fe2
+F test/wal3.test 09278a6f54b3a847b502f426a63a0a3028c4e57e
 F test/wal4.test 6a68c45bc1ca24a3592ec449ddcb92b29d0e0e87
 F test/wal_common.tcl 895d76138043b86bdccf36494054bdabcf65837b
 F test/walbak.test 767e1c9e0ea0cfb907873b332883e66e187fa4bc
@@ -801,8 +801,8 @@ F test/walcrash.test 80c1cc3173a0ef09d8303fa556cb0187a36d82ea
 F test/walcrash2.test 929c99d14ee2e3e3ef82585058968a8b12f72706
 F test/walfault.test 60527645638532a565a8e729db287ef0dba85ece
 F test/walhook.test c934ac5219fee2b4e7653d291db9107b8dc73bba
-F test/walmode.test c326079dd35481bbf1bbcf0f74a2d16463c97e49
-F test/walshared.test 985b4a3406b2b2dace1d52a42d26a11dd6900981
+F test/walmode.test 8746ec81f78597e0f988d8e31347dc1b9b22ebbd
+F test/walshared.test 51082db7d1edc720256c524e9b22e92c50f72149
 F test/walslow.test 989854bc5c214700a9f2d545bb158643813b8881
 F test/walthread.test e6e32e93ccebfa401dfc0dd930c79daa3472b0ae
 F test/where.test de337a3fe0a459ec7c93db16a519657a90552330
@@ -851,7 +851,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 782c33512ab2b677b0734c591fcecddc5a655203
-R 467c6229a39e637a404ffbb673aa3796
+P e01c5f3eda7fe6e6afe9c3894384f09b58173da1
+R 0f46b01a6860ee53146a14c10ec341dc
 U adam
-Z da8ed86c71f33338841987133c20b65c
+Z d51fce1db464c676813e4eba90c98e2f
index c713c40ac4559ad08f1c03869057b695cc3f5d4c..2d60ca9cf60001f0a6b66d814be07e1de9f0a52f 100644 (file)
@@ -1 +1 @@
-e01c5f3eda7fe6e6afe9c3894384f09b58173da1
\ No newline at end of file
+fd4d38fa66de85676189ff4922fb1bf5f8cac9c4
\ No newline at end of file
index e7a9fea8bc4738b51d039ebfc16d4e9c6754474a..cfe3c32bc46e445b5b427b528318d6f7af14b5ee 100644 (file)
@@ -1666,7 +1666,7 @@ int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){
   return oldLimit;
 }
 #if defined(SQLITE_ENABLE_AUTO_PROFILE)
-static void profile_sql(void *aux, const char *sql, uint64_t ns) {
+static void profile_sql(void *aux, const char *sql, u64 ns) {
 #pragma unused(aux)
        fprintf(stderr, "Query: %s\n Execution Time: %llu ms\n", sql, ns / 1000000);
 }
index 02b8fb14849cceb70e55e5b1f592c648103b7f1f..b67804f740c3455c82976670e5fbf6ffe1cf6be6 100644 (file)
@@ -3569,6 +3569,9 @@ static void unixShmPurge(unixFile *pFd){
   }
 }
 
+static int isProxyLockingMode(unixFile *);
+static const char *proxySharedMemoryBasePath(unixFile *);
+
 /*
 ** Open a shared-memory area associated with open database file pDbFd.  
 ** This particular implementation uses mmapped files.
@@ -3631,10 +3634,24 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
       goto shm_open_err;
     }
 
+    const char *zBasePath = pDbFd->zPath;
+#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
+    /* If pDbFd is configured with proxy locking mode, use the local 
+     ** lock file path to determine the -shm file path
+     */
+    if( isProxyLockingMode(pDbFd) ){
+      zBasePath = proxySharedMemoryBasePath(pDbFd);
+      if( !zBasePath ){
+        rc = SQLITE_CANTOPEN_BKPT;
+        goto shm_open_err;
+      }
+    }
+#endif
+    
 #ifdef SQLITE_SHM_DIRECTORY
     nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 30;
 #else
-    nShmFilename = 5 + (int)strlen(pDbFd->zPath);
+    nShmFilename = 5 + (int)strlen(zBasePath);
 #endif
     pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nShmFilename );
     if( pShmNode==0 ){
@@ -3648,7 +3665,7 @@ static int unixOpenSharedMemory(unixFile *pDbFd){
                      SQLITE_SHM_DIRECTORY "/sqlite-shm-%x-%x",
                      (u32)sStat.st_ino, (u32)sStat.st_dev);
 #else
-    sqlite3_snprintf(nShmFilename, zShmFilename, "%s-shm", pDbFd->zPath);
+    sqlite3_snprintf(nShmFilename, zShmFilename, "%s-shm", zBasePath);
 #endif
     pShmNode->h = -1;
     pDbFd->pInode->pShmNode = pShmNode;
@@ -4150,7 +4167,7 @@ static int proxyCheckReservedLock(sqlite3_file*, int*);
 IOMETHODS(
   proxyIoFinder,            /* Finder function name */
   proxyIoMethods,           /* sqlite3_io_methods object name */
-  1,                        /* shared memory is disabled */
+  2,                        /* shared memory is enabled */
   proxyClose,               /* xClose method */
   proxyLock,                /* xLock method */
   proxyUnlock,              /* xUnlock method */
@@ -4888,23 +4905,6 @@ static int unixOpen(
     if( envforce!=NULL ){
       useProxy = atoi(envforce)>0;
     }else{
-      struct statfs fsInfo;
-      if( statfs(zPath, &fsInfo) == -1 ){
-        /* In theory, the close(fd) call is sub-optimal. If the file opened
-        ** with fd is a database file, and there are other connections open
-        ** on that file that are currently holding advisory locks on it,
-        ** then the call to close() will cancel those locks. In practice,
-        ** we're assuming that statfs() doesn't fail very often. At least
-        ** not while other file descriptors opened by the same process on
-        ** the same file are working.  */
-        p->lastErrno = errno;
-        if( dirfd>=0 ){
-          close(dirfd); /* silently leak if fail, in error */
-        }
-        close(fd); /* silently leak if fail, in error */
-        rc = SQLITE_IOERR_ACCESS;
-        goto open_finished;
-      }
       useProxy = !(fsInfo.f_flags&MNT_LOCAL);
     }
     if( useProxy ){
@@ -5519,6 +5519,28 @@ static int proxyCreateLockPath(const char *lockPath){
   return 0;
 }
 
+static int isProxyLockingMode(unixFile *pFile) {
+  return (pFile->pMethod == &proxyIoMethods) ? 1 : 0;
+}
+
+/*
+** Return the shared memory base path based on the lock proxy file if the 
+** lock proxy file is hosted on a shared memory compatible FS
+*/
+static const char *proxySharedMemoryBasePath(unixFile *pFile) {
+  proxyLockingContext *pCtx;
+  unixFile *pLockFile;
+  
+  assert(pFile!=NULL && pFile->lockingContext!=NULL);
+  assert(pFile->pMethod == &proxyIoMethods);
+  pCtx = ((proxyLockingContext *)(pFile->lockingContext));
+  pLockFile = pCtx->lockProxy;
+  if( pLockFile->pMethod->iVersion>=2 && pLockFile->pMethod->xShmMap!=0 ){
+    return pCtx->lockProxyPath;
+  }
+  return NULL;
+}
+
 /*
 ** Create a new VFS file descriptor (stored in memory obtained from
 ** sqlite3_malloc) and open the file named "path" in the file descriptor.
@@ -5601,7 +5623,6 @@ static int proxyCreateUnixFile(
     *ppFile = pNew;
     return SQLITE_OK;
   }
-  sqlite3_free(pNew->pUnused);
 end_create_proxy:    
   close(fd); /* silently leak fd if error, we're already in error */
   sqlite3_free(pNew);
@@ -6245,7 +6266,7 @@ static int proxyFileControl(sqlite3_file *id, int op, void *pArg){
   switch( op ){
     case SQLITE_GET_LOCKPROXYFILE: {
       unixFile *pFile = (unixFile*)id;
-      if( pFile->pMethod == &proxyIoMethods ){
+      if( isProxyLockingMode(pFile) ){
         proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext;
         proxyTakeConch(pFile);
         if( pCtx->lockProxyPath ){
@@ -6261,10 +6282,13 @@ static int proxyFileControl(sqlite3_file *id, int op, void *pArg){
     case SQLITE_SET_LOCKPROXYFILE: {
       unixFile *pFile = (unixFile*)id;
       int rc = SQLITE_OK;
-      int isProxyStyle = (pFile->pMethod == &proxyIoMethods);
+      int isProxyStyle = isProxyLockingMode(pFile);
       if( pArg==NULL || (const char *)pArg==0 ){
         if( isProxyStyle ){
-          /* turn off proxy locking - not supported */
+          /* turn off proxy locking - not supported.  If support is added for
+          ** switching proxy locking mode off then it will need to fail if
+          ** the journal mode is WAL mode. 
+          */
           rc = SQLITE_ERROR /*SQLITE_PROTOCOL? SQLITE_MISUSE?*/;
         }else{
           /* turn off proxy locking - already off - NOOP */
index 05aa2a81e5840ff02d19803147d134d8f1e745e8..f3f2f6ac5003d0100496429a8f7e3062a7a028f0 100644 (file)
@@ -76,6 +76,7 @@ set skipwaltests [expr {
   [permutation]=="journaltest" || [permutation]=="inmemory_journal"
 }]
 ifcapable !wal { set skipwaltests 1 }
+if {![wal_is_ok]} { set skipwaltests 1 }
 
 if {!$skipwaltests} {
   db close
index 5257670529a62b26bd9511fac40afd3e953355f3..466c15fc0f8d1b4324a2051f329038e473b145a2 100644 (file)
@@ -126,7 +126,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
     set lockpath
   } {{:auto: (not held)}}
 
-  set lpp [pwd]/notmine
+  set lpp [exec mktemp -t fail]
   do_test lock6-1.4.1 {
     execsql "PRAGMA lock_proxy_file='$lpp'"
     catchsql {
@@ -151,7 +151,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
 
   catch {testfixture $::tf1 {db close}}
 
-  set lpp [pwd]/mine
+  set lpp [exec mktemp -t ok]
   do_test lock6-1.6 {
     execsql "PRAGMA lock_proxy_file='$lpp'"
     execsql {
index 827dbbd8f4609abc801d2b145f86f4594eb85864..48054a4f4934e015e9dd7633ad18dcda21059f9d 100644 (file)
@@ -27,7 +27,7 @@ db close
 file delete -force test.db.lock
 
 #####################################################################
-ifcapable lock_proxy_pragmas {
+ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   set ::using_proxy 0
   foreach {name value} [array get env SQLITE_FORCE_PROXY_LOCKING] {
     set ::using_proxy $value
@@ -135,7 +135,7 @@ ifcapable lock_proxy_pragmas {
 
 file delete -force test.db
 
-ifcapable lock_proxy_pragmas {
+ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   set env(SQLITE_FORCE_PROXY_LOCKING) $::using_proxy
 }
 
index fb1c796aa9ed97db3ecad749df786bbd6edae062..8d4397ded10dc461d0d68921e847f92f4abe2940 100644 (file)
@@ -1130,10 +1130,6 @@ if { $do_wal_tests } {
       do_test pager1-7.1.$tn.2 { list $J $W } [list $js $ws]
     }
   }
-} else {
-  do_test pager1-7.1.wal_is_not_ok {
-    execsql { PRAGMA journal_mode = WAL }
-  } {delete}
 }
 
 do_test pager1-7.2.1 {
@@ -2276,24 +2272,26 @@ do_test pager1.27.1 {
 # the same database.
 #
 catch { db close }
-do_multiclient_test tn {
-  do_test pager1-28.$tn.1 {
-    sql1 { 
-      PRAGMA journal_mode = WAL;
-      CREATE TABLE t1(a, b);
-      INSERT INTO t1 VALUES('a', 'b');
-    }
-  } {wal}
-  do_test pager1-28.$tn.2 { sql2 { SELECT * FROM t1 } } {a b}
-
-  do_test pager1-28.$tn.3 { sql1 { PRAGMA locking_mode=exclusive } } {exclusive}
-  do_test pager1-28.$tn.4 { 
-    csql1 { BEGIN; INSERT INTO t1 VALUES('c', 'd'); }
-  } {1 {database is locked}}
-  code2 { db2 close ; sqlite3 db2 test.db }
-  do_test pager1-28.$tn.4 { 
-    sql1 { INSERT INTO t1 VALUES('c', 'd'); COMMIT }
-  } {}
+if {[wal_is_ok]} {
+  do_multiclient_test tn {
+    do_test pager1-28.$tn.1 {
+      sql1 { 
+        PRAGMA journal_mode = WAL;
+        CREATE TABLE t1(a, b);
+        INSERT INTO t1 VALUES('a', 'b');
+      }
+    } {wal}
+    do_test pager1-28.$tn.2 { sql2 { SELECT * FROM t1 } } {a b}
+
+    do_test pager1-28.$tn.3 { sql1 { PRAGMA locking_mode=exclusive } } {exclusive}
+    do_test pager1-28.$tn.4 { 
+      csql1 { BEGIN; INSERT INTO t1 VALUES('c', 'd'); }
+    } {1 {database is locked}}
+    code2 { db2 close ; sqlite3 db2 test.db }
+    do_test pager1-28.$tn.4 { 
+      sql1 { INSERT INTO t1 VALUES('c', 'd'); COMMIT }
+    } {}
+  }
 }
 
 #-------------------------------------------------------------------------
index c78f8174200c4e860d1861d36dce6be39e696fd0..36a304fedb3a91696c833fa0a8e7234801f2e8b6 100644 (file)
@@ -1292,7 +1292,12 @@ sqlite3 dbX :memory:
 dbX eval {PRAGMA temp_store_directory = ""}
 dbX close
 
-ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
+set skip_lock_proxy_tests [path_is_dos "."]
+ifcapable !lock_proxy_pragmas&&prefer_proxy_locking {
+  set skip_lock_proxy_tests 1
+}
+
+if !$skip_lock_proxy_tests {
   set sqlite_hostid_num 1
 
   set using_proxy 0
@@ -1307,7 +1312,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
 
   sqlite3 db test.db
   # set lock proxy name and then query it via pragma interface
-  set lpp [pwd]/proxyfile_1
+  set lpp [exec mktemp -t 'proxy1']
   do_test pragma-16.1 {
     execsql "PRAGMA lock_proxy_file='$lpp'"
     execsql "select * from sqlite_master"
@@ -1332,7 +1337,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   } $lpp
 
   db2 close
-  set lpp2 [pwd]/proxyfile_2
+  set lpp2 [exec mktemp -t 'proxy2']
 
   # 2nd database connection cannot override the lock proxy file
   do_test pragma-16.3 {
@@ -1343,7 +1348,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
     } db2
   } {1 {database is locked}}
 
-  set lpp3 [pwd]/unused_proxyfile
+  set lpp3 [exec mktemp -t 'proxy3']
 
   # lock proxy file can be renamed if no other connections are active
   do_test pragma-16.4 {
@@ -1399,7 +1404,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   } {1 {database is locked}}
 
   db2 close
-  set lpp4 [pwd]/proxyfile_4
+  set lpp4 [exec mktemp -t 'proxy4']
 
   # check that db is unlocked after first host connection closes 
   do_test pragma-16.8.1 {
@@ -1428,7 +1433,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   } {1}
 
   # ensure creating directories for a lock proxy file works
-  set lpp5 [pwd]/proxytest/sub/dir/lock
+  set lpp5 [exec mktemp -d -t "proxy5"]/sub/dir/lock
   db close
   file delete -force proxytest
   do_test pragma-16.10.1 {
@@ -1437,7 +1442,7 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
     set lockpath2 [execsql {
       PRAGMA lock_proxy_file;
     } db]
-    string match "*proxytest/sub/dir/lock" $lockpath2
+    string match "*sub/dir/lock" $lockpath2
   } {1}
 
   # ensure that after deleting the path, setting ":auto:" works correctly
@@ -1445,12 +1450,12 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   file delete -force proxytest
   do_test pragma-16.10.2 {
     sqlite3 db proxytest.db
-    set lockpath2 [execsql {
+    set lockpath3 [execsql {
       PRAGMA lock_proxy_file=":auto:";
       create table if not exists pt(y);
       PRAGMA lock_proxy_file;
     } db]
-    string match "*proxytest/sub/dir/lock" $lockpath2
+    string match "*sub/dir/lock" $lockpath3
   } {1}
 
   # ensure that if the path can not be created (file instead of dir)
@@ -1469,17 +1474,17 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
   } {1}
 
   # make sure we can deal with ugly file paths correctly
-  set lpp6 [pwd]/./././////./proxytest/../proxytest/sub/dir/lock
+  set lpp6 [exec mktemp -d -t "proxy6"]/./././////./proxytest/../proxytest/sub/dir/lock
   db close
   file delete -force proxytest
   do_test pragma-16.10.4 {
     sqlite3 db proxytest.db
     execsql "PRAGMA lock_proxy_file='$lpp6'" 
-    set lockpath2 [execsql {
+    set lockpath4 [execsql {
       create table if not exists aa(bb);
       PRAGMA lock_proxy_file;
     } db]
-    string match "*proxytest/sub/dir/lock" $lockpath2
+    string match "*proxytest/sub/dir/lock" $lockpath4
   } {1}
 
   # ensure that if the path can not be created (perm), setting :auto: deals
@@ -1496,12 +1501,12 @@ ifcapable lock_proxy_pragmas&&prefer_proxy_locking {
     file mkdir proxytest
     file attributes proxytest -permission 0000
     sqlite3 db proxytest.db
-    set lockpath2 [execsql {
+    set lockpath5 [execsql {
       PRAGMA lock_proxy_file=":auto:";
       create table if not exists cc(bb);
       PRAGMA lock_proxy_file;
     } db]
-    string match "*proxytest.db:auto:" $lockpath2
+    string match "*proxytest.db:auto:" $lockpath5
   } {1}
 
   # ensure that if the path can not be created, locking fails
index f107f477a096e16f7e39b7d66e5b61e5b3e442c5..ba87aa4aad2559b0296d3e81b111970d672079e7 100644 (file)
@@ -1183,7 +1183,7 @@ proc forced_proxy_locking {} {
 
 proc wal_is_ok {} {
   if { [forced_proxy_locking] } {
-    return 0
+    return 1
   }
   if { ![path_is_local "."] } {
     return 0
index e5670cbfcfac3885a6c7de23f39d9df782ff4618..8813936f7e91a049d2ae6a3d6ff21a04281d3398 100644 (file)
@@ -617,7 +617,7 @@ T delete
 #-------------------------------------------------------------------------
 # 
 do_test wal3-8.1 {
-  file delete -force test.db test.db-journal test.db wal
+  file delete -force test.db test.db-journal test.db wal .test.db-conch
   sqlite3 db test.db
   sqlite3 db2 test.db
   execsql {
index b8c739b2b4d2674dd2b6757a1a29391effb2d63c..c5be7afecfa2ee7a611e07bfaebb41f2c5042df9 100644 (file)
@@ -35,7 +35,7 @@ ifcapable !wal {
   finish_test
   return
 }
-if { ![wal_is_ok] } {
+if { ![wal_is_ok] && ![path_is_dos "."]} {
   do_test walmode-0.1 {
     execsql { PRAGMA journal_mode = wal }
   } {delete}
index 658a25f9e11e3aba8ae1201564f3012ecb4bfd23..8e53ea66e4d5596b1f737a67a3651a445635cd68 100644 (file)
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
+
+ifcapable !wal {finish_test ; return }
+if { ![wal_is_ok] } {
+  finish_test 
+  return 
+}
+
 db close
 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]