From cc47eac00555ac1af94fde3ab9f8c7d2b6bf8766 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 24 Mar 2016 15:09:14 +0000 Subject: [PATCH 01/13] Fix some test scripts so that they work with various permutations. FossilOrigin-Name: f4d234b5013bf93b6eac7f8be6d4c074cf9f5293 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/snapshot.test | 9 +++++++++ test/snapshot_fault.test | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index f86978ab06..19ae78878e 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\scalling\srealloc()\swith\sa\szero\ssize\sin\sfuzzcheck.c. -D 2016-03-23T17:54:19.633 +C Fix\ssome\stest\sscripts\sso\sthat\sthey\swork\swith\svarious\spermutations. +D 2016-03-24T15:09:14.368 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1042,8 +1042,8 @@ F test/skipscan2.test d1d1450952b7275f0b0a3a981f0230532743951a F test/skipscan3.test ec5bab3f81c7038b43450e7b3062e04a198bdbb5 F test/skipscan5.test 67817a4b6857c47e0e33ba3e506da6f23ef68de2 F test/skipscan6.test 5866039d03a56f5bd0b3d172a012074a1d90a15b -F test/snapshot.test c03eb5ba1602df33c1edc1d12393d6ca7a282a46 -F test/snapshot_fault.test 25973aeb1b86a280800e0bcf1eb5ce70e9ef57ab +F test/snapshot.test 9ed24c792fb05382814258daf68b2256f23de57f +F test/snapshot_fault.test 062ff0438a074978d45e9f9a92e7ad459b74ee73 F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f F test/softheap1.test 843cd84db9891b2d01b9ab64cef3e9020f98d087 F test/sort.test c2adc635c2564241fefec0b3a68391ef6868fd3b @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3fa88f68c3e1bbb3421cb0d2b82b9bb3fe7b9b14 -R 6050811335a4694faefeb0d2dc871228 -U drh -Z bf4eed3170d70e06db77678976293947 +P a1fd14694c1adc54e5c443ebfdef38e38637f5c5 +R 36309b59b7cae947470048aeed54391f +U dan +Z b85dfb4995f4f514e1ad3337ff91de1c diff --git a/manifest.uuid b/manifest.uuid index fc3163dd80..7a09317688 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a1fd14694c1adc54e5c443ebfdef38e38637f5c5 \ No newline at end of file +f4d234b5013bf93b6eac7f8be6d4c074cf9f5293 \ No newline at end of file diff --git a/test/snapshot.test b/test/snapshot.test index ba3a666796..c6710e3691 100644 --- a/test/snapshot.test +++ b/test/snapshot.test @@ -17,6 +17,15 @@ source $testdir/tester.tcl ifcapable !snapshot {finish_test; return} set testprefix snapshot +# This test does not work with the inmemory_journal permutation. The reason +# is that each connection opened as part of this permutation executes +# "PRAGMA journal_mode=memory", which fails if the database is in wal mode +# and there are one or more existing connections. +if {[permutation]=="inmemory_journal"} { + finish_test + return +} + #------------------------------------------------------------------------- # Check some error conditions in snapshot_get(). It is an error if: # diff --git a/test/snapshot_fault.test b/test/snapshot_fault.test index 3ac13daefd..f90690e3f6 100644 --- a/test/snapshot_fault.test +++ b/test/snapshot_fault.test @@ -146,7 +146,7 @@ do_faultsim_test 3.0 -prep { error $msg } } -test { - faultsim_test_result {0 {}} {1 SQLITE_IOERR} \ + faultsim_test_result {0 {}} {1 SQLITE_IOERR} {1 SQLITE_NOMEM} \ {1 SQLITE_IOERR_NOMEM} {1 SQLITE_IOERR_READ} if {$testrc==0} { set res [db eval { From d38a2e2511daf120d37c58c95e333e29bdb7f3a4 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 24 Mar 2016 15:32:19 +0000 Subject: [PATCH 02/13] Larger margins for one memsubsys1 range check when running with a non-zero reserved-bytes value. FossilOrigin-Name: 6db1d1fbc6c1acc896fa635dfdc5564800502c40 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/memsubsys1.test | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 19ae78878e..63d4b9b8b2 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\stest\sscripts\sso\sthat\sthey\swork\swith\svarious\spermutations. -D 2016-03-24T15:09:14.368 +C Larger\smargins\sfor\sone\smemsubsys1\srange\scheck\swhen\srunning\swith\sa\nnon-zero\sreserved-bytes\svalue. +D 2016-03-24T15:32:19.097 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -892,7 +892,7 @@ F test/manydb.test 28385ae2087967aa05c38624cec7d96ec74feb3e F test/mem5.test c6460fba403c5703141348cd90de1c294188c68f F test/memdb.test c1f2a343ad14398d5d6debda6ea33e80d0dafcc7 F test/memleak.test 10b9c6c57e19fc68c32941495e9ba1c50123f6e2 -F test/memsubsys1.test 69924593856040e266fdd9aa1ecb4d5a0888eb12 +F test/memsubsys1.test 6d268d0ae90f8d61a2356a1838665654d83de518 F test/memsubsys2.test 3e4a8d0c05fd3e5fa92017c64666730a520c7e08 F test/minmax.test 42fbad0e81afaa6e0de41c960329f2b2c3526efd F test/minmax2.test b44bae787fc7b227597b01b0ca5575c7cb54d3bc @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a1fd14694c1adc54e5c443ebfdef38e38637f5c5 -R 36309b59b7cae947470048aeed54391f -U dan -Z b85dfb4995f4f514e1ad3337ff91de1c +P f4d234b5013bf93b6eac7f8be6d4c074cf9f5293 +R 918e030f39e9a5a455482186d2119a1e +U drh +Z 4c4813ba0d5bb38b250579ca5f32f159 diff --git a/manifest.uuid b/manifest.uuid index 7a09317688..75cadabba3 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f4d234b5013bf93b6eac7f8be6d4c074cf9f5293 \ No newline at end of file +6db1d1fbc6c1acc896fa635dfdc5564800502c40 \ No newline at end of file diff --git a/test/memsubsys1.test b/test/memsubsys1.test index f0b060fc9f..36427f9bae 100644 --- a/test/memsubsys1.test +++ b/test/memsubsys1.test @@ -257,7 +257,7 @@ do_test memsubsys1-7.4 { } 0 do_test memsubsys1-7.5 { set maxreq [lindex [sqlite3_status SQLITE_STATUS_MALLOC_SIZE 0] 2] - expr {$maxreq<4100 + 4200*[nonzero_reserved_bytes]} + expr {$maxreq<(4100 + 8200*[nonzero_reserved_bytes])} } 1 do_test memsubsys1-7.6 { set s_used [lindex [sqlite3_status SQLITE_STATUS_SCRATCH_USED 0] 2] From eb2329bed34ec38248e7d78ed34fc79eb9976cc2 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Thu, 24 Mar 2016 20:36:47 +0000 Subject: [PATCH 03/13] Prevent negative values of SQLITE_DEFAULT_CACHE_SIZE from making SQLITE_WIN32_HEAP_INIT_SIZE negative. FossilOrigin-Name: e0737f5236ed3e85bd03203c880ee41b34619137 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 14 +++++++++++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 63d4b9b8b2..3716cd5a4b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Larger\smargins\sfor\sone\smemsubsys1\srange\scheck\swhen\srunning\swith\sa\nnon-zero\sreserved-bytes\svalue. -D 2016-03-24T15:32:19.097 +C Prevent\snegative\svalues\sof\sSQLITE_DEFAULT_CACHE_SIZE\sfrom\smaking\sSQLITE_WIN32_HEAP_INIT_SIZE\snegative. +D 2016-03-24T20:36:47.715 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -338,7 +338,7 @@ F src/os.h 91ff889115ecd01f436d3611f7f5ea4dc12d92f1 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c b1ccb273771f41dbdbe0ba7c1ad63c38ad5972ec -F src/os_win.c 17493f12b0b023c2d5a349b6860009f0d45e08d6 +F src/os_win.c 7c071f7f8f04827ab25a8f441080832be58688e9 F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c 38718a019ca762ba4f6795425d5a54db70d1790d F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f4d234b5013bf93b6eac7f8be6d4c074cf9f5293 -R 918e030f39e9a5a455482186d2119a1e -U drh -Z 4c4813ba0d5bb38b250579ca5f32f159 +P 6db1d1fbc6c1acc896fa635dfdc5564800502c40 +R 5e26e94cafc58d6fd55eccc4e6c637ee +U mistachkin +Z 1088b9c27d83d36a2ae2a2fd6824e14f diff --git a/manifest.uuid b/manifest.uuid index 75cadabba3..1b00761a79 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -6db1d1fbc6c1acc896fa635dfdc5564800502c40 \ No newline at end of file +e0737f5236ed3e85bd03203c880ee41b34619137 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 3f9fefcac4..7ae833d3f5 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -344,11 +344,23 @@ struct winFile { # define SQLITE_WIN32_HEAP_CREATE (TRUE) #endif +/* + * This is cache size used in the calculation of the initial size of the + * Win32-specific heap. It cannot be negative. + */ +#ifndef SQLITE_WIN32_CACHE_SIZE +# if SQLITE_DEFAULT_CACHE_SIZE>=0 +# define SQLITE_WIN32_CACHE_SIZE (SQLITE_DEFAULT_CACHE_SIZE) +# else +# define SQLITE_WIN32_CACHE_SIZE (-(SQLITE_DEFAULT_CACHE_SIZE)) +# endif +#endif + /* * The initial size of the Win32-specific heap. This value may be zero. */ #ifndef SQLITE_WIN32_HEAP_INIT_SIZE -# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_DEFAULT_CACHE_SIZE) * \ +# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_WIN32_CACHE_SIZE) * \ (SQLITE_DEFAULT_PAGE_SIZE) + 4194304) #endif From cb620b479783d42e637b7b54631879daa89f30f7 Mon Sep 17 00:00:00 2001 From: drh Date: Thu, 24 Mar 2016 20:55:03 +0000 Subject: [PATCH 04/13] Make test cases in shell1.test robust against TCL deciding to quote strings using lots of backslashes. FossilOrigin-Name: 817e93f42c09eb876421e27eb8eceb7b077cb45d --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/shell1.test | 10 ++++++---- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 3716cd5a4b..7c64a1af14 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Prevent\snegative\svalues\sof\sSQLITE_DEFAULT_CACHE_SIZE\sfrom\smaking\sSQLITE_WIN32_HEAP_INIT_SIZE\snegative. -D 2016-03-24T20:36:47.715 +C Make\stest\scases\sin\sshell1.test\srobust\sagainst\sTCL\sdeciding\sto\squote\sstrings\nusing\slots\sof\sbackslashes. +D 2016-03-24T20:55:03.263 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1028,7 +1028,7 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test e7dac9830b7d80432be9cebfae06eff9c18675f5 +F test/shell1.test 94538224ee7b7a52952dea67d2633b358abde271 F test/shell2.test 2e7a32c9ee03c6398478637d72416d5b9ebd9777 F test/shell3.test c39453d3012a39ffec944566eca8a6bda10a2284 F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 6db1d1fbc6c1acc896fa635dfdc5564800502c40 -R 5e26e94cafc58d6fd55eccc4e6c637ee -U mistachkin -Z 1088b9c27d83d36a2ae2a2fd6824e14f +P e0737f5236ed3e85bd03203c880ee41b34619137 +R 203f39504a0cd47826f57431bf7289e6 +U drh +Z ba68271edf3c6755b87aa606194c0bcd diff --git a/manifest.uuid b/manifest.uuid index 1b00761a79..d8ea0b1033 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e0737f5236ed3e85bd03203c880ee41b34619137 \ No newline at end of file +817e93f42c09eb876421e27eb8eceb7b077cb45d \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index 1f1f3de320..b08c08ffc0 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -275,12 +275,14 @@ do_test shell1-3.2.4 { # .databases List names and files of attached databases do_test shell1-3.3.1 { - catchcmd "-csv test.db" ".databases" -} "/0 +.*main +[string map {/ .} [string range [get_pwd] 0 10]].*/" + set x [catchcmd "-csv test.db" ".databases"] + set x [subst -nocommands -novariables $x] +} "/0.+main.+[string map {/ .} [string range [get_pwd] 0 10]].*/" do_test shell1-3.3.2 { # extra arguments ignored - catchcmd "test.db" ".databases BAD" -} "/0 +.*main +[string map {/ .} [string range [get_pwd] 0 10]].*/" + set x [catchcmd "test.db" ".databases BAD"] + set x [subst -nocommands -novariables $x] +} "/0.+main.+[string map {/ .} [string range [get_pwd] 0 10]].*/" # .dump ?TABLE? ... Dump the database in an SQL text format # If TABLE specified, only dump tables matching From ddb2b4a31015c8ad93f52f8c07ae8e592e6d02c6 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 25 Mar 2016 12:10:32 +0000 Subject: [PATCH 05/13] Fix two instances of undefined behavior in the C code - both harmless for all current compilers. FossilOrigin-Name: 99fd194c83dbcfcdcc582983b86678b85b1b9570 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/build.c | 6 +++--- src/vdbe.c | 4 +++- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 7c64a1af14..9995948b77 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Make\stest\scases\sin\sshell1.test\srobust\sagainst\sTCL\sdeciding\sto\squote\sstrings\nusing\slots\sof\sbackslashes. -D 2016-03-24T20:55:03.263 +C Fix\stwo\sinstances\sof\sundefined\sbehavior\sin\sthe\sC\scode\s-\sboth\sharmless\sfor\nall\scurrent\scompilers. +D 2016-03-25T12:10:32.929 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -300,7 +300,7 @@ F src/btmutex.c bc87dd3b062cc26edfe79918de2200ccb8d41e73 F src/btree.c 577fb5674e2f0aa0a38246afc19e1885a0b8c9b0 F src/btree.h a5008b9afe56e8e54ade6c436a910f112defcca9 F src/btreeInt.h c18b7d2a3494695133e4e60ee36061d37f45d9a5 -F src/build.c 7d1a5e64fcd10110edc8ce9ffb710d06af0a59f5 +F src/build.c 39faaaeecb77eb3936d4bd5024e865e3836ca323 F src/callback.c 2e76147783386374bf01b227f752c81ec872d730 F src/complete.c a3634ab1e687055cd002e11b8f43eb75c17da23e F src/ctime.c 60e135af364d777a9ab41c97e5e89cd224da6198 @@ -419,7 +419,7 @@ F src/update.c 56b3db7edff0110360a12b76af97c39ebe3ea8b8 F src/utf.c 699001c79f28e48e9bcdf8a463da029ea660540c F src/util.c 8873d696c9ccc4206058c402e09e101f1b81561a F src/vacuum.c feb1eabb20987983d9350cad98299b21fa811f52 -F src/vdbe.c f19741f2d8b33e8f09cd2219570b6c9ed924c3f1 +F src/vdbe.c cd990451b504507b455cc649d46dad51f2835a67 F src/vdbe.h 6f44193e7be52fd5f7c308175a936555b1e6b101 F src/vdbeInt.h f88d3115e9bde33b01d81f0dd26d8dd51f995991 F src/vdbeapi.c 95b1f8e527240a18a9aea41a655b013bf07a7009 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P e0737f5236ed3e85bd03203c880ee41b34619137 -R 203f39504a0cd47826f57431bf7289e6 +P 817e93f42c09eb876421e27eb8eceb7b077cb45d +R aca0111531dd13b444e2634c40aa3c16 U drh -Z ba68271edf3c6755b87aa606194c0bcd +Z a7abe0dd0ebfdb648c54f66b764dd2a5 diff --git a/manifest.uuid b/manifest.uuid index d8ea0b1033..eec1194704 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -817e93f42c09eb876421e27eb8eceb7b077cb45d \ No newline at end of file +99fd194c83dbcfcdcc582983b86678b85b1b9570 \ No newline at end of file diff --git a/src/build.c b/src/build.c index 28eb55ab6c..d4d0c173cc 100644 --- a/src/build.c +++ b/src/build.c @@ -1056,9 +1056,6 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ memcpy(z, pName->z, pName->n); z[pName->n] = 0; sqlite3Dequote(z); - zType = z + sqlite3Strlen30(z) + 1; - memcpy(zType, pType->z, pType->n); - zType[pType->n] = 0; for(i=0; inCol; i++){ if( sqlite3_stricmp(z, p->aCol[i].zName)==0 ){ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); @@ -1086,6 +1083,9 @@ void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ pCol->affinity = SQLITE_AFF_BLOB; pCol->szEst = 1; }else{ + zType = z + sqlite3Strlen30(z) + 1; + memcpy(zType, pType->z, pType->n); + zType[pType->n] = 0; pCol->affinity = sqlite3AffinityType(zType, &pCol->szEst); pCol->colFlags |= COLFLAG_HASTYPE; } diff --git a/src/vdbe.c b/src/vdbe.c index 90269cbe30..e6d17ad26e 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -2524,7 +2524,6 @@ case OP_Column: { }while( i<=p2 && zHdrnHdrParsed = i; pC->iHdrOffset = (u32)(zHdr - zData); - if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); /* The record is corrupt if any of the following are true: ** (1) the bytes of the header extend past the declared header size @@ -2534,9 +2533,12 @@ case OP_Column: { if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize)) || (offset64 > pC->payloadSize) ){ + if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); rc = SQLITE_CORRUPT_BKPT; goto abort_due_to_error; } + if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem); + }else{ t = 0; } From 5729c31dafbf5bb7796f62cb30e3b6c7ae32d4d4 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 25 Mar 2016 17:09:16 +0000 Subject: [PATCH 06/13] Add the catchcmd_collapse_space command and use it to help make shell testing more robust against TCL space escapes. FossilOrigin-Name: 93caabb66082f76ef161a51ac822b919517a7171 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/shell1.test | 6 ++---- test/tester.tcl | 11 +++++++++++ 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index 9995948b77..b34eb55e70 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\stwo\sinstances\sof\sundefined\sbehavior\sin\sthe\sC\scode\s-\sboth\sharmless\sfor\nall\scurrent\scompilers. -D 2016-03-25T12:10:32.929 +C Add\sthe\scatchcmd_collapse_space\scommand\sand\suse\sit\sto\shelp\smake\sshell\stesting\nmore\srobust\sagainst\sTCL\sspace\sescapes. +D 2016-03-25T17:09:16.750 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1028,7 +1028,7 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test 94538224ee7b7a52952dea67d2633b358abde271 +F test/shell1.test 12d1774936facc17a889e0c31877670ef5526f8c F test/shell2.test 2e7a32c9ee03c6398478637d72416d5b9ebd9777 F test/shell3.test c39453d3012a39ffec944566eca8a6bda10a2284 F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9 @@ -1088,7 +1088,7 @@ F test/tclsqlite.test c6d9f546f79d15d0134c1e06583fb3ee0c3afad3 F test/tempdb.test bd92eba8f20e16a9136e434e20b280794de3cdb6 F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30 F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1 -F test/tester.tcl f2b99e912d4da1e5755969b8614febd883885c8b +F test/tester.tcl 5604f2697e8fa9b12b6180122d84e1a9093ca8a3 F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5 F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 817e93f42c09eb876421e27eb8eceb7b077cb45d -R aca0111531dd13b444e2634c40aa3c16 +P 99fd194c83dbcfcdcc582983b86678b85b1b9570 +R cfe872b896f4c791395847cc13daead3 U drh -Z a7abe0dd0ebfdb648c54f66b764dd2a5 +Z 0d389fd777e66fc5d8e3b6840aab7902 diff --git a/manifest.uuid b/manifest.uuid index eec1194704..aa0e2349f2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -99fd194c83dbcfcdcc582983b86678b85b1b9570 \ No newline at end of file +93caabb66082f76ef161a51ac822b919517a7171 \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index b08c08ffc0..87edc3c816 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -275,13 +275,11 @@ do_test shell1-3.2.4 { # .databases List names and files of attached databases do_test shell1-3.3.1 { - set x [catchcmd "-csv test.db" ".databases"] - set x [subst -nocommands -novariables $x] + catchcmd_collapse_space "-csv test.db" ".databases" } "/0.+main.+[string map {/ .} [string range [get_pwd] 0 10]].*/" do_test shell1-3.3.2 { # extra arguments ignored - set x [catchcmd "test.db" ".databases BAD"] - set x [subst -nocommands -novariables $x] + catchcmd_collapse_space "test.db" ".databases BAD" } "/0.+main.+[string map {/ .} [string range [get_pwd] 0 10]].*/" # .dump ?TABLE? ... Dump the database in an SQL text format diff --git a/test/tester.tcl b/test/tester.tcl index eadaf2eb31..75963e108d 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -823,6 +823,17 @@ proc catchcmd {db {cmd ""}} { list $rc $msg } +proc catchcmd_collapse_space {db {cmd ""}} { + global CLI + set out [open cmds.txt w] + puts $out $cmd + close $out + set line "exec $CLI $db < cmds.txt" + set rc [catch { eval $line } msg] + regsub -all {\s+} $msg { } msg + list $rc $msg +} + proc catchcmdex {db {cmd ""}} { global CLI set out [open cmds.txt w] From 82452480ea1d3e7bad96914a82377bda1ae10ed1 Mon Sep 17 00:00:00 2001 From: mistachkin Date: Fri, 25 Mar 2016 17:19:57 +0000 Subject: [PATCH 07/13] In the Win32 VFS, avoid trying to use rand_s() on Windows CE. FossilOrigin-Name: 183350fa7cc6a5ab8bd0a86cab231a6e4c915890 --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/os_win.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b34eb55e70..8558fe1c18 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sthe\scatchcmd_collapse_space\scommand\sand\suse\sit\sto\shelp\smake\sshell\stesting\nmore\srobust\sagainst\sTCL\sspace\sescapes. -D 2016-03-25T17:09:16.750 +C In\sthe\sWin32\sVFS,\savoid\strying\sto\suse\srand_s()\son\sWindows\sCE. +D 2016-03-25T17:19:57.501 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -338,7 +338,7 @@ F src/os.h 91ff889115ecd01f436d3611f7f5ea4dc12d92f1 F src/os_common.h b2f4707a603e36811d9b1a13278bffd757857b85 F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa F src/os_unix.c b1ccb273771f41dbdbe0ba7c1ad63c38ad5972ec -F src/os_win.c 7c071f7f8f04827ab25a8f441080832be58688e9 +F src/os_win.c ff870d89f4cb088a04cbf5ea0cbd9ff1b089ff4a F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c 38718a019ca762ba4f6795425d5a54db70d1790d F src/pager.h e1d38a2f14849e219df0f91f8323504d134c8a56 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 99fd194c83dbcfcdcc582983b86678b85b1b9570 -R cfe872b896f4c791395847cc13daead3 -U drh -Z 0d389fd777e66fc5d8e3b6840aab7902 +P 93caabb66082f76ef161a51ac822b919517a7171 +R 5aa2c9bfd4173374520b94533760d2da +U mistachkin +Z 700a9aa1ab3cd081c3674af5a63a2d5f diff --git a/manifest.uuid b/manifest.uuid index aa0e2349f2..f363c251a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -93caabb66082f76ef161a51ac822b919517a7171 \ No newline at end of file +183350fa7cc6a5ab8bd0a86cab231a6e4c915890 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 7ae833d3f5..f64a7d43a7 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -5436,7 +5436,7 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ EntropyGatherer e; UNUSED_PARAMETER(pVfs); memset(zBuf, 0, nBuf); -#if defined(_MSC_VER) && _MSC_VER>=1400 +#if defined(_MSC_VER) && _MSC_VER>=1400 && !SQLITE_OS_WINCE rand_s((unsigned int*)zBuf); /* rand_s() is not available with MinGW */ #endif /* defined(_MSC_VER) && _MSC_VER>=1400 */ e.a = (unsigned char*)zBuf; From 4f69540b7168fc0d83e6191ae8e6c42d3c3d1946 Mon Sep 17 00:00:00 2001 From: drh Date: Fri, 25 Mar 2016 20:10:20 +0000 Subject: [PATCH 08/13] Do not run the shell3.test module under mingw because of mingw's dodgy command-line parsing. FossilOrigin-Name: a7c080a90a236fbc18b9a42b78dbed4dd8a25160 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/shell3.test | 7 +++++++ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 8558fe1c18..b02404a99f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sWin32\sVFS,\savoid\strying\sto\suse\srand_s()\son\sWindows\sCE. -D 2016-03-25T17:19:57.501 +C Do\snot\srun\sthe\sshell3.test\smodule\sunder\smingw\sbecause\sof\smingw's\sdodgy\ncommand-line\sparsing. +D 2016-03-25T20:10:20.882 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1030,7 +1030,7 @@ F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 F test/shell1.test 12d1774936facc17a889e0c31877670ef5526f8c F test/shell2.test 2e7a32c9ee03c6398478637d72416d5b9ebd9777 -F test/shell3.test c39453d3012a39ffec944566eca8a6bda10a2284 +F test/shell3.test 1448cb715b8b5f139d96e0e4d3e94ae31fd0a713 F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9 F test/shell5.test 50a732c1c2158b1cd62cf53975ce1ea7ce6b9dc9 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 93caabb66082f76ef161a51ac822b919517a7171 -R 5aa2c9bfd4173374520b94533760d2da -U mistachkin -Z 700a9aa1ab3cd081c3674af5a63a2d5f +P 183350fa7cc6a5ab8bd0a86cab231a6e4c915890 +R 9c42844e710d61bbe7fe13708d65edbf +U drh +Z ea11cf0717b5526a95e62f1683bac7ce diff --git a/manifest.uuid b/manifest.uuid index f363c251a7..7dafaa5910 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -183350fa7cc6a5ab8bd0a86cab231a6e4c915890 \ No newline at end of file +a7c080a90a236fbc18b9a42b78dbed4dd8a25160 \ No newline at end of file diff --git a/test/shell3.test b/test/shell3.test index 3ded8f5ccd..08d31f24eb 100644 --- a/test/shell3.test +++ b/test/shell3.test @@ -26,6 +26,13 @@ db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db +if {[info exists env(MSYSCON)] && $env(MSYSCON)=="sh.exe"} { + puts "shell3 tests do not work with the mingw shell due to dodgy\ + command-line parsing" + finish_test + return +} + #---------------------------------------------------------------------------- # shell3-1.*: Basic tests for running SQL statments from command line. # From 15707ac992d801d2d637a0b59c21a9b7c6413cf5 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 26 Mar 2016 13:26:35 +0000 Subject: [PATCH 09/13] Update shell1.test tests to deal with backslash escaping in TCL on Windows-style pathnames. FossilOrigin-Name: 219a251e182bf43376fbc8ae1ce6f77f18a1b092 --- manifest | 12 ++++++------ manifest.uuid | 2 +- test/shell1.test | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index b02404a99f..71c59993da 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Do\snot\srun\sthe\sshell3.test\smodule\sunder\smingw\sbecause\sof\smingw's\sdodgy\ncommand-line\sparsing. -D 2016-03-25T20:10:20.882 +C Update\sshell1.test\stests\sto\sdeal\swith\sbackslash\sescaping\sin\sTCL\son\sWindows-style\npathnames. +D 2016-03-26T13:26:35.335 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1028,7 +1028,7 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test 12d1774936facc17a889e0c31877670ef5526f8c +F test/shell1.test 25de3bf73c2a24fd3f0240396a3719d8679fd156 F test/shell2.test 2e7a32c9ee03c6398478637d72416d5b9ebd9777 F test/shell3.test 1448cb715b8b5f139d96e0e4d3e94ae31fd0a713 F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 183350fa7cc6a5ab8bd0a86cab231a6e4c915890 -R 9c42844e710d61bbe7fe13708d65edbf +P a7c080a90a236fbc18b9a42b78dbed4dd8a25160 +R 4fb0bc40e02c2e4ca004a6ff507130b3 U drh -Z ea11cf0717b5526a95e62f1683bac7ce +Z 2e9acf052ed53f3a7f143522bd4e6960 diff --git a/manifest.uuid b/manifest.uuid index 7dafaa5910..37f54adfef 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a7c080a90a236fbc18b9a42b78dbed4dd8a25160 \ No newline at end of file +219a251e182bf43376fbc8ae1ce6f77f18a1b092 \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index 87edc3c816..44886b9f38 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -276,11 +276,11 @@ do_test shell1-3.2.4 { # .databases List names and files of attached databases do_test shell1-3.3.1 { catchcmd_collapse_space "-csv test.db" ".databases" -} "/0.+main.+[string map {/ .} [string range [get_pwd] 0 10]].*/" +} "/0.+main.+[string map {/ ".{1,2}"} [string range [get_pwd] 0 10]].*/" do_test shell1-3.3.2 { # extra arguments ignored catchcmd_collapse_space "test.db" ".databases BAD" -} "/0.+main.+[string map {/ .} [string range [get_pwd] 0 10]].*/" +} "/0.+main.+[string map {/ ".{1,2}"} [string range [get_pwd] 0 10]].*/" # .dump ?TABLE? ... Dump the database in an SQL text format # If TABLE specified, only dump tables matching From eaa544d44d7c06dc858a8acbd5b10852f2032dad Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 26 Mar 2016 14:41:13 +0000 Subject: [PATCH 10/13] Remove the catchcmd_collapse_space procedure in tester.tcl - no longer needed. FossilOrigin-Name: 3bd499d3bdf4e80f83513966c2ee9dd11e67cbd1 --- manifest | 14 +++++++------- manifest.uuid | 2 +- test/shell1.test | 4 ++-- test/tester.tcl | 11 ----------- 4 files changed, 10 insertions(+), 21 deletions(-) diff --git a/manifest b/manifest index 71c59993da..a1183f5492 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Update\sshell1.test\stests\sto\sdeal\swith\sbackslash\sescaping\sin\sTCL\son\sWindows-style\npathnames. -D 2016-03-26T13:26:35.335 +C Remove\sthe\scatchcmd_collapse_space\sprocedure\sin\stester.tcl\s-\sno\slonger\sneeded. +D 2016-03-26T14:41:13.450 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1028,7 +1028,7 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test 25de3bf73c2a24fd3f0240396a3719d8679fd156 +F test/shell1.test d36a68f0d560b7f50177845e409910ed855b1a27 F test/shell2.test 2e7a32c9ee03c6398478637d72416d5b9ebd9777 F test/shell3.test 1448cb715b8b5f139d96e0e4d3e94ae31fd0a713 F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9 @@ -1088,7 +1088,7 @@ F test/tclsqlite.test c6d9f546f79d15d0134c1e06583fb3ee0c3afad3 F test/tempdb.test bd92eba8f20e16a9136e434e20b280794de3cdb6 F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30 F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1 -F test/tester.tcl 5604f2697e8fa9b12b6180122d84e1a9093ca8a3 +F test/tester.tcl f2b99e912d4da1e5755969b8614febd883885c8b F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5 F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P a7c080a90a236fbc18b9a42b78dbed4dd8a25160 -R 4fb0bc40e02c2e4ca004a6ff507130b3 +P 219a251e182bf43376fbc8ae1ce6f77f18a1b092 +R c56b0aa6959f9b74a14b039c91d81909 U drh -Z 2e9acf052ed53f3a7f143522bd4e6960 +Z 93b7eb233dfe81212bc718ee014c61a9 diff --git a/manifest.uuid b/manifest.uuid index 37f54adfef..bd4275f994 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -219a251e182bf43376fbc8ae1ce6f77f18a1b092 \ No newline at end of file +3bd499d3bdf4e80f83513966c2ee9dd11e67cbd1 \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index 44886b9f38..8669559e44 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -275,11 +275,11 @@ do_test shell1-3.2.4 { # .databases List names and files of attached databases do_test shell1-3.3.1 { - catchcmd_collapse_space "-csv test.db" ".databases" + catchcmd "-csv test.db" ".databases" } "/0.+main.+[string map {/ ".{1,2}"} [string range [get_pwd] 0 10]].*/" do_test shell1-3.3.2 { # extra arguments ignored - catchcmd_collapse_space "test.db" ".databases BAD" + catchcmd "test.db" ".databases BAD" } "/0.+main.+[string map {/ ".{1,2}"} [string range [get_pwd] 0 10]].*/" # .dump ?TABLE? ... Dump the database in an SQL text format diff --git a/test/tester.tcl b/test/tester.tcl index 75963e108d..eadaf2eb31 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -823,17 +823,6 @@ proc catchcmd {db {cmd ""}} { list $rc $msg } -proc catchcmd_collapse_space {db {cmd ""}} { - global CLI - set out [open cmds.txt w] - puts $out $cmd - close $out - set line "exec $CLI $db < cmds.txt" - set rc [catch { eval $line } msg] - regsub -all {\s+} $msg { } msg - list $rc $msg -} - proc catchcmdex {db {cmd ""}} { global CLI set out [open cmds.txt w] From 60c4249fcc5bb322e3f380ad3181dbb381a7f404 Mon Sep 17 00:00:00 2001 From: drh Date: Sat, 26 Mar 2016 15:36:36 +0000 Subject: [PATCH 11/13] More changes to the shellN.test scripts to get them working on all variations of Windows. FossilOrigin-Name: 8213c2f58167243411d29cc58e303b4be656f756 --- manifest | 16 ++++++++-------- manifest.uuid | 2 +- test/shell1.test | 2 +- test/shell2.test | 2 +- test/shell3.test | 11 ++++++++--- 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/manifest b/manifest index a1183f5492..8d623daff5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Remove\sthe\scatchcmd_collapse_space\sprocedure\sin\stester.tcl\s-\sno\slonger\sneeded. -D 2016-03-26T14:41:13.450 +C More\schanges\sto\sthe\sshellN.test\sscripts\sto\sget\sthem\sworking\son\sall\svariations\nof\sWindows. +D 2016-03-26T15:36:36.768 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1028,9 +1028,9 @@ F test/sharedA.test 0cdf1a76dfa00e6beee66af5b534b1e8df2720f5 F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e F test/shared_err.test 2f2aee20db294b9924e81f6ccbe60f19e21e8506 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 -F test/shell1.test d36a68f0d560b7f50177845e409910ed855b1a27 -F test/shell2.test 2e7a32c9ee03c6398478637d72416d5b9ebd9777 -F test/shell3.test 1448cb715b8b5f139d96e0e4d3e94ae31fd0a713 +F test/shell1.test dff5b20ad989770aface6d714491121172dfe8b0 +F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b +F test/shell3.test da513d522ef6f01cee8475dcf8332bff8982b3dd F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9 F test/shell5.test 50a732c1c2158b1cd62cf53975ce1ea7ce6b9dc9 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 219a251e182bf43376fbc8ae1ce6f77f18a1b092 -R c56b0aa6959f9b74a14b039c91d81909 +P 3bd499d3bdf4e80f83513966c2ee9dd11e67cbd1 +R 0f980ceb534899c3d74e7aadbdc990e8 U drh -Z 93b7eb233dfe81212bc718ee014c61a9 +Z 6df6f858842cee4837ac5cccff369bba diff --git a/manifest.uuid b/manifest.uuid index bd4275f994..23fb133ea2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3bd499d3bdf4e80f83513966c2ee9dd11e67cbd1 \ No newline at end of file +8213c2f58167243411d29cc58e303b4be656f756 \ No newline at end of file diff --git a/test/shell1.test b/test/shell1.test index 8669559e44..49b6a7923d 100644 --- a/test/shell1.test +++ b/test/shell1.test @@ -45,7 +45,7 @@ do_test shell1-1.1.1b { } {1 1} # error on extra options do_test shell1-1.1.2 { - catchcmd "test.db \"select 3\" \"select 4\"" "" + catchcmd "test.db \"select+3\" \"select+4\"" "" } {0 {3 4}} # error on extra options diff --git a/test/shell2.test b/test/shell2.test index 9388b719b3..2de6bf7514 100644 --- a/test/shell2.test +++ b/test/shell2.test @@ -43,7 +43,7 @@ do_test shell2-1.1.1 { # Shell silently ignores extra parameters. # Ticket [f5cb008a65]. do_test shell2-1.2.1 { - set rc [catch { eval exec $CLI \":memory:\" \"select 3\" \"select 4\" } msg] + set rc [catch { eval exec $CLI \":memory:\" \"select+3\" \"select+4\" } msg] list $rc $msg } {0 {3 4}} diff --git a/test/shell3.test b/test/shell3.test index 08d31f24eb..6e38021d0c 100644 --- a/test/shell3.test +++ b/test/shell3.test @@ -26,9 +26,14 @@ db close forcedelete test.db test.db-journal test.db-wal sqlite3 db test.db -if {[info exists env(MSYSCON)] && $env(MSYSCON)=="sh.exe"} { - puts "shell3 tests do not work with the mingw shell due to dodgy\ - command-line parsing" +# There are inconsistencies in command-line argument quoting on Windows. +# In particular, individual applications are responsible for command-line +# parsing in Windows, not the shell. Depending on whether the sqlite3.exe +# program is compiled with MinGW or MSVC, the command-line parsing is +# different. This causes problems for the tests below. To avoid +# issues, these tests are disabled for windows. +# +if {$::tcl_platform(platform)=="windows"} { finish_test return } From 72cd360caffca027211972e1189e26c8ad121995 Mon Sep 17 00:00:00 2001 From: drh Date: Mon, 28 Mar 2016 11:01:54 +0000 Subject: [PATCH 12/13] Fix the multiplexor so that it does not assume that the xGetLastError method is non-NULL in the child VFS. FossilOrigin-Name: f6a88cccbc0c62a0b453f4711298c9d5e1882b18 --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/test_multiplex.c | 6 +++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/manifest b/manifest index 8d623daff5..943c941a23 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\schanges\sto\sthe\sshellN.test\sscripts\sto\sget\sthem\sworking\son\sall\svariations\nof\sWindows. -D 2016-03-26T15:36:36.768 +C Fix\sthe\smultiplexor\sso\sthat\sit\sdoes\snot\sassume\sthat\sthe\sxGetLastError\smethod\nis\snon-NULL\sin\sthe\schild\sVFS. +D 2016-03-28T11:01:54.323 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -390,7 +390,7 @@ F src/test_intarray.h 9dc57417fb65bc7835cc18548852cc08cc062202 F src/test_journal.c 5360fbe1d1e4416ca36290562fd5a2e3f70f32aa F src/test_loadext.c 337056bae59f80b9eb00ba82088b39d0f4fe6dfd F src/test_malloc.c 96df9381a1ff1f6d3805ff7231b9baf1386aaabf -F src/test_multiplex.c 6a088d8d9d4aad4bec45dd8878af11b15900702d +F src/test_multiplex.c 6a9de820fcaaf506c59aa14bc8693822333cea48 F src/test_multiplex.h c08e4e8f8651f0c5e0509b138ff4d5b43ed1f5d3 F src/test_mutex.c dbdfaff8580071f2212a0deae3325a93a737819c F src/test_onefile.c 38f7cbe79d5bafe95bde683cc3a53b8ca16daf10 @@ -1459,7 +1459,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3bd499d3bdf4e80f83513966c2ee9dd11e67cbd1 -R 0f980ceb534899c3d74e7aadbdc990e8 +P 8213c2f58167243411d29cc58e303b4be656f756 +R 345c74a0cb9568a53ff6b8825c4a812b U drh -Z 6df6f858842cee4837ac5cccff369bba +Z 80e7037d98d6e1826970b484373d3274 diff --git a/manifest.uuid b/manifest.uuid index 23fb133ea2..7c1af05774 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -8213c2f58167243411d29cc58e303b4be656f756 \ No newline at end of file +f6a88cccbc0c62a0b453f4711298c9d5e1882b18 \ No newline at end of file diff --git a/src/test_multiplex.c b/src/test_multiplex.c index 82845ea7e1..07dcbbc1aa 100644 --- a/src/test_multiplex.c +++ b/src/test_multiplex.c @@ -717,7 +717,11 @@ static int multiplexCurrentTime(sqlite3_vfs *a, double *b){ return gMultiplex.pOrigVfs->xCurrentTime(gMultiplex.pOrigVfs, b); } static int multiplexGetLastError(sqlite3_vfs *a, int b, char *c){ - return gMultiplex.pOrigVfs->xGetLastError(gMultiplex.pOrigVfs, b, c); + if( gMultiplex.pOrigVfs->xGetLastError ){ + return gMultiplex.pOrigVfs->xGetLastError(gMultiplex.pOrigVfs, b, c); + }else{ + return 0; + } } static int multiplexCurrentTimeInt64(sqlite3_vfs *a, sqlite3_int64 *b){ return gMultiplex.pOrigVfs->xCurrentTimeInt64(gMultiplex.pOrigVfs, b); From 10df23fe4f73a8eb1bd820f22b6e65e3bcbfd09d Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 29 Mar 2016 10:14:15 +0000 Subject: [PATCH 13/13] Version 3.12.0 FossilOrigin-Name: e9bb4cf40f4971974a74468ef922bdee481c988b --- manifest | 11 +++++++---- manifest.uuid | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/manifest b/manifest index 943c941a23..769e820b33 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sthe\smultiplexor\sso\sthat\sit\sdoes\snot\sassume\sthat\sthe\sxGetLastError\smethod\nis\snon-NULL\sin\sthe\schild\sVFS. -D 2016-03-28T11:01:54.323 +C Version\s3.12.0 +D 2016-03-29T10:14:15.762 F Makefile.in f53429fb2f313c099283659d0df6f20f932c861f F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc df0bf9ff7f8b3f4dd9fb4cc43f92fe58f6ec5c66 @@ -1459,7 +1459,10 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 8213c2f58167243411d29cc58e303b4be656f756 +P f6a88cccbc0c62a0b453f4711298c9d5e1882b18 R 345c74a0cb9568a53ff6b8825c4a812b +T +bgcolor * #d0c0ff +T +sym-relaese * +T +sym-version-3.12.0 * U drh -Z 80e7037d98d6e1826970b484373d3274 +Z 9c957a50c25c5de44ce9010b47906f30 diff --git a/manifest.uuid b/manifest.uuid index 7c1af05774..21845f2bab 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f6a88cccbc0c62a0b453f4711298c9d5e1882b18 \ No newline at end of file +e9bb4cf40f4971974a74468ef922bdee481c988b \ No newline at end of file