From: drh Date: Mon, 7 Dec 2009 23:53:51 +0000 (+0000) Subject: Merge all changes associated with the version 3.6.21 release into the OS-X X-Git-Tag: mountain-lion~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca071dfd756edd9eeddab67e533663262e12f3d3;p=thirdparty%2Fsqlite.git Merge all changes associated with the version 3.6.21 release into the OS-X branch. FossilOrigin-Name: ad08794d7239bb804eb39c00170821732b60cb65 --- ca071dfd756edd9eeddab67e533663262e12f3d3 diff --cc Makefile.in index e54834d81a,3bc5d8fda3..54c9649b70 --- a/Makefile.in +++ b/Makefile.in @@@ -437,9 -439,7 +442,9 @@@ HDR += $(TOP)/ext/rtree/rtree.h HDR += \ $(TOP)/ext/icu/sqliteicu.h +HDR += \ + $(TOP)/ext/sqlrr/sqlrr.h - + # 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 diff --cc manifest index 2823d88879,d8e009b542..2ec90ed444 --- a/manifest +++ b/manifest @@@ -1,7 -1,10 +1,10 @@@ - C Fix\sfor\slock\sstructure\ssharing\swith\sAFP-style\slocking - D 2009-11-09T19:30:44 + -----BEGIN PGP SIGNED MESSAGE----- + Hash: SHA1 + -C Version\s3.6.21\srelease\scandidate\s3. -D 2009-12-07T16:39:13 ++C Merge\sall\schanges\sassociated\swith\sthe\sversion\s3.6.21\srelease\sinto\sthe\sOS-X\nbranch. ++D 2009-12-07T23:53:52 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 - F Makefile.in 3400e494a10756968f8fcd8c3d553d279a063436 -F Makefile.in c5827ead754ab32b9585487177c93bb00b9497b3 ++F Makefile.in df768f5addf7b6da984aa279123d2671d716cf5c F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 F Makefile.vxworks 10010ddbf52e2503c7c49c7c0b7c7a096f8638a6 F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6 @@@ -72,24 -77,21 +77,24 @@@ F ext/icu/README.txt 3b130aa66e7a681136 F ext/icu/icu.c 12e763d288d23b5a49de37caa30737b971a2f1e2 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/rtree/README 6315c0d73ebf0ec40dedb5aa0e942bc8b54e3761 - F ext/rtree/rtree.c 375a762b17e307d1f9574b2563a0144ced58b021 -F ext/rtree/rtree.c 038d59b05783c2e6c927a7352bb118a76c31065a ++F ext/rtree/rtree.c 823d089fea8148f19be1c2fb4ff6ccf3e8ec966c F ext/rtree/rtree.h 834dbcb82dc85b2481cde6a07cdadfddc99e9b9e - F ext/rtree/rtree1.test 207041aba07fdcdd93aa797a745839d305181857 - F ext/rtree/rtree2.test 9ac9d28fa948779df66916c67a5dcf9704c3cb74 - F ext/rtree/rtree3.test 877a09c1a0c2b87af0f94f3a286e7dd3b65adf22 - F ext/rtree/rtree4.test 11724f766a74f48710998cdd7552cec140c55bf9 - F ext/rtree/rtree5.test 7d0643482829038f0263881ddf7e2d51bff1d60f - F ext/rtree/rtree6.test 119d991e8651fb1dbb1fa31af67ad280fbe4adf7 - F ext/rtree/rtree_perf.tcl 0fabb6d5c48cb8024e042ce5d4bb88998b6ec1cb - F ext/rtree/rtree_util.tcl ee0a0311eb12175319d78bfb37302320496cee6e - F ext/rtree/tkt3363.test 6662237ea75bb431cd5d262dfc9535e1023315fc - F ext/rtree/viewrtree.tcl 09526398dae87a5a87c5aac2b3854dbaf8376869 + F ext/rtree/rtree1.test f72885ed80a329d6bd7991043016d74b51edf2c5 + F ext/rtree/rtree2.test 7b665c44d25e51b3098068d983a39902b2e2d7a1 + F ext/rtree/rtree3.test dece988c363368af8c11862995c762071894918f + F ext/rtree/rtree4.test 94fdd570ab5bc47244d87d4590023be43ac786bd + F ext/rtree/rtree5.test 92508f5152a50110af6551fa5b769d1bbd7c4ef3 + F ext/rtree/rtree6.test 11aade5311789068ca659be24a47cc0d852b1971 + F ext/rtree/rtree_perf.tcl 6c18c1f23cd48e0f948930c98dfdd37dfccb5195 + F ext/rtree/rtree_util.tcl 06aab2ed5b826545bf215fff90ecb9255a8647ea + F ext/rtree/tkt3363.test 2bf324f7908084a5f463de3109db9c6e607feb1b + F ext/rtree/viewrtree.tcl eea6224b3553599ae665b239bd827e182b466024 +F ext/sqlrr/README.txt 4239030e73023e72a2e727808cd433577d5bf730 +F ext/sqlrr/sqlrr.c 8d1e6571cd6a6beabdb5bcdfe3a0e723b914db41 +F ext/sqlrr/sqlrr.h 09e4f8929ad9bc2638732c0cc0db5eef8c417824 F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8 - F main.mk d588eab5d51b0bfe924a1cccdfdd2cbb4cbe40b4 + F main.mk a92b99b264c3b277f8cf74d50aadc22c55967ef0 F mkdll.sh 7d09b23c05d56532e9d44a50868eb4b12ff4f74a F mkextu.sh 416f9b7089d80e5590a29692c9d9280a10dbad9f F mkextw.sh 4123480947681d9b434a5e7b1ee08135abe409ac @@@ -102,122 -104,125 +107,125 @@@ F spec.template 86a4a43b99ebb3e75e6b9a7 F sqlite.pc.in 42b7bf0d02e08b9e77734a47798d1a55a9e0716b F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad - F src/alter.c 9e4b52e6b1d3a26242cf2ce680c9fce801f00aa1 - F src/analyze.c 5a8b8aa3d170eac5e71af45458cec61f83c623ee - F src/attach.c 13995348fc5a26cdd136a50806faf292aabc173f - F src/auth.c a5471a6951a18f79d783da34be22cd94dfbe603a - F src/backup.c 6f1c2d9862c8a3feb7739dfcca02c1f5352e37f3 - F src/bitvec.c ed215b95734045e58358c3b3e16448f8fe6a235a - F src/btmutex.c 0f43a75bb5b8147b386e8e1c3e71ba734e3863b7 - F src/btree.c 3b29423f08987bddeb115562d6a699b002f653ae - F src/btree.h 577448a890c2ab9b21e6ab74f073526184bceebe - F src/btreeInt.h 1c863e543bb55772fa8db95535c370bb386c578c - F src/build.c 3c5762687d0554ebe8844dfaddb828fcc15fe16d - F src/callback.c 10d237171472865f58fb07d515737238c9e06688 - F src/complete.c 5ad5c6cd4548211867c204c41a126d73a9fbcea0 - F src/date.c 657ff12ca0f1195b531561afacbb38b772d16638 - F src/delete.c 308e300d599d2d11b838687e2cf7309d42f29a1a - F src/expr.c 501269f7598cd7f39664c2ed6c360a6d48956396 - F src/fault.c dc88c821842157460750d2d61a8a8b4197d047ff - F src/fkey.c 41219cba186bcf0a053e42327dfa23aaba4f834a - F src/func.c 1ddc1c93a0bb350977361e60e6067b3827ea9e81 - F src/global.c 271952d199a8cc59d4ce840b3bbbfd2f30c8ba32 - F src/hash.c ebcaa921ffd9d86f7ea5ae16a0a29d1c871130a7 - F src/hash.h 35b216c13343d0b4f87d9f21969ac55ad72174e1 - F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb - F src/insert.c 2fe2ef7bd03d6e0120e4525727c4ae7de5a2d571 - F src/journal.c e00df0c0da8413ab6e1bb7d7cab5665d4a9000d0 - F src/legacy.c 3ec1880541904c6135fcca548a272a6301bdc951 + F src/alter.c 92ba938565d7cc6bfe92aad6cc90c00800ff21d3 + F src/analyze.c 55155f05ee9ab4ce33b7a4d19c449053f8935200 + F src/attach.c 0ba38b38252a34bb9721de35514a1d14058a8e49 + F src/auth.c 523da7fb4979469955d822ff9298352d6b31de34 + F src/backup.c 744e98359dfc79fed43e8dec911e33e108b06aae + F src/bitvec.c 06ad2c36a9c3819c0b9cbffec7b15f58d5d834e0 + F src/btmutex.c 96a12f50f7a17475155971a241d85ec5171573ff + F src/btree.c efdef3953c49e28f8b8fa9cc0ac5754cc1a7489a + F src/btree.h 7944a9dac59eb3e541aad45fd2747f1051e7c63d + F src/btreeInt.h 54f4245decd0409ea52cf9aee422d3d761d7ac10 + F src/build.c a48e74d24897100017d39ceba5de255e53ec9488 + F src/callback.c 908f3e0172c3d4058f4ca0acd42c637c52e9669f + F src/complete.c 417df1ef5ea798532bb6290b0cc4265fef82980a + F src/date.c a79c0a8f219370b972e320741f995a3bef9df33f + F src/delete.c 8b8afb9cd7783d573eae55a3f4208bc0637a2bb8 + F src/expr.c 50385ed51f1cd7f1ab289629cd0f87d5b2fcca52 + F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb + F src/fkey.c e2116672a6bd610dc888e27df292ebc7999c9bb0 -F src/func.c bf54e1202cbfb28bf4b1fd9b58899009ae76716f ++F src/func.c 44bab6e35e2a1128f1b75fa54220d5bd99acb784 + F src/global.c 75946a4a2ab41c6ae58f10ca0ed31b3449694b26 + F src/hash.c 458488dcc159c301b8e7686280ab209f1fb915af + F src/hash.h 2894c932d84d9f892d4b4023a75e501f83050970 + F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 + F src/insert.c f9c6098988675ac258b2f98ea5f7e370fc9990fa + F src/journal.c b0ea6b70b532961118ab70301c00a33089f9315c -F src/legacy.c 9304428e71b1d622b764913e1432e69156814755 ++F src/legacy.c 3c3f78cbe4ada0b17b208da1e2e2773d6a96f27d F src/lempar.c 7f026423f4d71d989e719a743f98a1cbd4e6d99e - F src/loadext.c 0e88a335665db0b2fb4cece3e49dcb65d832635a - F src/main.c a1c50e3bf1c07f02542de6390f75638e2621d8be - F src/malloc.c 685561d2f1602042e349aea5d7a88c3f10a63454 - F src/mem0.c f2f84062d1f35814d6535c9f9e33de3bfb3b132c - F src/mem1.c b46d8dab40d9fdcde5048d62753f6787acebb806 - F src/mem2.c d02bd6a5b34f2d59012a852615621939d9c09548 - F src/mem3.c 805ab642adfafa171781a5d8ab112119dfaef118 + F src/loadext.c 1c7a61ce1281041f437333f366a96aa0d29bb581 -F src/main.c aae32d5af35b88faff0664e0f937ee7133d77c8d ++F src/main.c ab13ef864a854d94e0a66566be43e3ad013ac468 + F src/malloc.c 5fa175797f982b178eaf38afba9c588a866be729 + F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 -F src/mem1.c 552f7e11486272f27948d2de9c012884d1f52908 ++F src/mem1.c 34cb5c25e4d2c1dcbdce244745999babf8d8dc5c + F src/mem2.c 3f196f6fd3f4320035eb4acbe4530686da2f14b1 + F src/mem3.c 9b237d911ba9904142a804be727cc6664873f8a3 F src/mem5.c 4837b795ebdecc0cfe1522cd0c8b2c5d84ea490d - F src/memjournal.c e68cb5f7e828b84d5bf2ea16c5d87f1ed7e9fe7f - F src/mutex.c 828a40bc7bf79f01ef95ccbf8db8b02857739449 - F src/mutex.h 32ddef38560ce0128d7e7b3eb063f5c6eff889a3 - F src/mutex_noop.c f5a07671f25a1a9bd7c10ad7107bc2585446200f - F src/mutex_os2.c 6b5a74f812082a8483c3df05b47bbaac2424b9a0 - F src/mutex_unix.c aff26c77f698b552becfedfa677ad1036c42d790 - F src/mutex_w32.c b2c1481ee93b0ac7a8fa5346570fd173b6763fdb - F src/notify.c 0127121816d8a861deb0dfd111b495346bf233db - F src/os.c 8d62d8d98ad7909cb0dd294c1e5f3835c887ccb6 - F src/os.h 00a1334a4eecee7f7bef79ac606b88d325119f21 - F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc - F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 - F src/os_unix.c 6b74fa8300c2db55a143155371405ab49ae6afdf + F src/memjournal.c 5bfc2f33c914946e2f77ed3f882aff14dfc9355d + F src/mutex.c 581a272e09098040ca3ef543cb5f3d643eff7d50 + F src/mutex.h 6fde601e55fa6c3fae768783c439797ab84c87c6 + F src/mutex_noop.c 5f58eaa31f2d742cb8957a747f7887ae98f16053 + F src/mutex_os2.c 20477db50cf3817c2f1cd3eb61e5c177e50231db + F src/mutex_unix.c 04a25238abce7e3d06b358dcf706e26624270809 + F src/mutex_w32.c 9ec75bcef0ca722821be7968c320fd725abfb984 + F src/notify.c f799bbda67ab6619b36b0a24153b49518874a203 + F src/os.c 4500ff276e277730776fe9b6c6c5930383ec4000 + F src/os.h 534b082c3cb349ad05fa6fa0b06087e022af282c + F src/os_common.h 240c88b163b02c21a9f21f87d49678a0aa21ff30 + F src/os_os2.c 75a8c7b9a00a2cf1a65f9fa4afbc27d46634bb2f -F src/os_unix.c fe85acfeded5cc13c2340ab73c9baf841de4e6d9 ++F src/os_unix.c afabe88b8a208bd80d283282ce4dc48b53dc080e F src/os_win.c 5ffab20249a61e0625f869efe157fa009747039b - F src/pager.c 729f73feeb33355ae1f0982a74f112ce190c74aa - F src/pager.h 11852d044c86cf5a9d6e34171fb0c4fcf1f6265f - F src/parse.y 0204f0dfe8974dc2a0d46eb9ab98a433a1f963d6 - F src/pcache.c c92ffd4f3e1279b3766854c6d18b5bf4aac0d1fa - F src/pcache.h 435ef324197f79391f9c92b71d7f92b548ad7a36 - F src/pcache1.c 211295a9ff6a5b30f1ca50516731a5cf3e9bf82c - F src/pragma.c 840143b9e0cadfbd744a24b0b918a057f0aba7ff - F src/prepare.c 6ea9df8369f12f50b3ca92fdd0bd8f2037c48115 - F src/printf.c 508a1c59433353552b6553cba175eaa7331f8fc1 - F src/random.c 676b9d7ac820fe81e6fb2394ac8c10cff7f38628 - F src/resolve.c 1166b41dd6b0859bf31a26a8855bcddc819e6c46 - F src/rowset.c c64dafba1f9fd876836c8db8682966b9d197eb1f - F src/select.c cbe366a0ce114856e66f5daf0f848d7c48a88298 - F src/shell.c f66531a57fff927f95c98d99c28237d88e400c86 - F src/sqlite.h.in b000e2bc16eb429b4cd8f47faf0047094967a0e9 - F src/sqlite3ext.h 1db7d63ab5de4b3e6b83dd03d1a4e64fef6d2a17 - F src/sqliteInt.h b0661039d644645e5c5e60e179cb9c3f502805a0 - F src/sqliteLimit.h 38b2fffcd01faeaeaadea71b2b47695a81580c8b - F src/status.c 237b193efae0cf6ac3f0817a208de6c6c6ef6d76 - F src/table.c cc86ad3d6ad54df7c63a3e807b5783c90411a08d - F src/tclsqlite.c c2c4047177213baf485d4401c7dbb30a3c2ba322 - F src/test1.c 9a4ee438435acfcf6418991a33e08bfe99e602bf - F src/test2.c 0de743ec8890ca4f09e0bce5d6d5a681f5957fec - F src/test3.c 2445c2beb5e7a0c91fd8136dc1339ec369a24898 - F src/test4.c b5fd530f02a6a0dbffb23be202168a690985dedd - F src/test5.c 162a1cea2105a2c460a3f39fa6919617b562a288 - F src/test6.c 1a0a7a1f179469044b065b4a88aab9faee114101 - F src/test7.c b94e68c2236de76889d82b8d7d8e00ad6a4d80b1 - F src/test8.c 34719910286a0a6ca233f10ba66558be938494dd - F src/test9.c 963d380922f25c1c323712d05db01b19197ee6f7 - F src/test_async.c 731d23f953ece5bf40ce87810cfb7607218953c5 - F src/test_autoext.c f53b0cdf7bf5f08100009572a5d65cdb540bd0ad - F src/test_backup.c c775b759a7aedd48e9e6651b44b16e54ad11218c - F src/test_btree.c 5adbba9b138988a3cf4d3b5424dbc7c85651da02 - F src/test_config.c 4ac1e6257dcf926a71b7934410b71c5c326e68f2 - F src/test_devsym.c 9f4bc2551e267ce7aeda195f3897d0f30c5228f4 - F src/test_func.c c6e9d7cfbd7bb0bd7c392a10d76adab4b48e813b - F src/test_hexio.c 2f1122aa3f012fa0142ee3c36ce5c902a70cd12f - F src/test_init.c f6a5dfaf2fb52d697eec1c825a641e5893c339d2 - F src/test_journal.c dab49b7c47b53242f039c9563b18cafb67ebfe03 - F src/test_loadext.c 97dc8800e46a46ed002c2968572656f37e9c0dd9 - F src/test_malloc.c d054506b095d711e4e5575558dd576a2cbf035a2 - F src/test_mutex.c 482d9d987c1c678199691efc23c8cd3464e01ff5 - F src/test_onefile.c d2c3126633592aeef14e8d268fc40c74449b69d8 - F src/test_osinst.c 9a70a61e127f9e72bcfca000b20368b1c5367873 - F src/test_pcache.c d770f933888b2afe856c1abcefc64eda5941ffef - F src/test_schema.c 4b4bf7bb329326458c491b0e6facd4c8c4c5b479 - F src/test_server.c f0a403b5f699c09bd2b1236b6f69830fd6221f6b - F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4 - F src/test_thread.c b8a1ab7ca1a632f18e8a361880d5d65eeea08eac - F src/test_wsd.c 3ae5101de6cbfda2720152ab659ea84079719241 - F src/tokenize.c af8a56e6a50c5042fc305bfa796275e9bf26ff2b - F src/trigger.c 2053afa9952f69cf451bc0e6ea88072701f2925e - F src/update.c 8e8535f66c32d946199cb1caad19646a97ead3a7 - F src/utf.c 3586a6a2457c5c88b6816f6cda58a54e291883f8 - F src/util.c 59d4e9456bf1fe581f415a783fa0cee6115c8f35 - F src/vacuum.c 48e1282bbd5eac4b461587c51658378658c00770 - F src/vdbe.c a435ffcf6bfc7f14eb40998062ccbd7dfa482319 - F src/vdbe.h 449323a21c02226790acb6189dae78af17b92b78 - F src/vdbeInt.h aa08465efa812288688a72613a2584079d294c62 - F src/vdbeapi.c de488c6311de23a68c1c4499eb76144f4b2ec8dd - F src/vdbeaux.c 7cb0daeb128fff205183ce3efb10a94ed75ae705 - F src/vdbeblob.c 9bfaeab22e261a6a7b6df04e7faaf7d6dfdbef5a - F src/vdbemem.c 7055a2941a7802094f4704cedc7a28cc88a23749 - F src/vtab.c 3e54fe39374e5feb8b174de32a90e7a21966025d - F src/walker.c 1edca756275f158b80f20eb6f104c8d3fcc96a04 - F src/where.c fac37876e09e005e52cdfcf896090b6f5ebbf25b + F src/pager.c a0ed14b86de9d012a962b83389ca01003b6acccb + F src/pager.h 1b32faf2e578ac3e7bcf9c9d11217128261c5c54 + F src/parse.y b172fba9a954855502271556497c440506b6daf4 + F src/pcache.c 3b079306376e0e04c0d3df40c0a4b750a1839310 + F src/pcache.h c683390d50f856d4cd8e24342ae62027d1bb6050 + F src/pcache1.c 2bb2261190b42a348038f5b1c285c8cef415fcc8 -F src/pragma.c 6936d7df5e04b9f996f8f320d15e65b6944b2caa -F src/prepare.c ad90970bba3aead154266d8bb6faf9fbb5233b94 ++F src/pragma.c eda3d6d165966e443301f9715adcae6b425655c1 ++F src/prepare.c 23edf67b059372086378685ddf8c91ea82d9114a + F src/printf.c 644bc7d59df3dc56d6d8b9a510914bfc6b51bc69 + F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50 + F src/resolve.c d052e5c44bab34f83b3c1741aaa07478d18b5dd5 + F src/rowset.c 69afa95a97c524ba6faf3805e717b5b7ae85a697 + F src/select.c 2f9ed7482e7a25b0b127fc41693bbdbe1caf5647 + F src/shell.c f4948cb6d30665d755a6b5e0ec313d1094aab828 -F src/sqlite.h.in 2d34605565e021851255e0bbcb15f8c1930d1f6f ++F src/sqlite.h.in d4bb934f1e2b77924096f4913efc2139bc9851fc + F src/sqlite3ext.h 69dfb8116af51b84a029cddb3b35062354270c89 + F src/sqliteInt.h e946a6a3f2df015cdbc7668e9626987e8badbb5f + F src/sqliteLimit.h 3afab2291762b5d09ae20c18feb8e9fa935a60a6 + F src/status.c e651be6b30d397d86384c6867bc016e4913bcac7 + F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e + F src/tclsqlite.c bad6570a005b234ea670b9f7b48256da19a032d3 -F src/test1.c db4d8fd2849ab9aca0f27fd3773b8d68d078cf86 ++F src/test1.c db87de2bf5d804cdf408eb7b1773793ef8c42e22 + F src/test2.c b6b43413d495addd039a88b87d65c839f86b18cb + F src/test3.c f17eeaf8114205844d76f4e69bab27ea341087af + F src/test4.c ad03bb987ddedce928f4258c1e7fa4109a73497d + F src/test5.c cc55900118fa4add8ec9cf69fc4225a4662f76b1 + F src/test6.c a8ece4284d0e34477f349ac05655db73c48e0926 + F src/test7.c 3f2d63e4ccf97f8c2cf1a7fa0a3c8e2e2a354e6e + F src/test8.c f959db9a22d882013b64c92753fa793b2ce3bdea + F src/test9.c bea1e8cf52aa93695487badedd6e1886c321ea60 + F src/test_async.c c1656facbaf43cb2e71b62621e5b9eb080e2621c + F src/test_autoext.c 30e7bd98ab6d70a62bb9ba572e4c7df347fe645e -F src/test_backup.c c129c91127e9b46e335715ae2e75756e25ba27de ++F src/test_backup.c 64fd6173ad99daade1227aa17c3ca0d18fa5e5fa + F src/test_btree.c 47cd771250f09cdc6e12dda5bc71bc0b3abc96e2 + F src/test_config.c 220a67047af393756f55760fdf442d935d0d88f3 + F src/test_devsym.c de3c9af2bb9a8b1e44525c449e4ec3f88e3d4110 + F src/test_func.c 1c94388a23d4a9e7cd62ec79d612d1bae2451fa2 + F src/test_hexio.c 415adbdb88cd9388831ce10edff76cb9e73d8a0b + F src/test_init.c 5d624ffd0409d424cf9adbfe1f056b200270077c + F src/test_intarray.c d879bbf8e4ce085ab966d1f3c896a7c8b4f5fc99 + F src/test_intarray.h 489edb9068bb926583445cb02589344961054207 + F src/test_journal.c adc0ce3840ed19b49feb1d583b2212f560ef7866 + F src/test_loadext.c df586c27176e3c2cb2e099c78da67bf14379a56e + F src/test_malloc.c f777d15df756bea0e98271932464ac5d882e66fe + F src/test_mutex.c ce06b59aca168cd8c520b77159a24352a7469bd3 + F src/test_onefile.c 06da7e085dce42924cf062b91763dd4bb84c6101 + F src/test_osinst.c 90fb03d396f39956897dfb4bd0e62c6711db1cca + F src/test_pcache.c 7bf828972ac0d2403f5cfa4cd14da41f8ebe73d8 + F src/test_schema.c 8c06ef9ddb240c7a0fcd31bc221a6a2aade58bf0 + F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6 + F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa + F src/test_thread.c 00fed80690ae7f1525483a35861511c48bc579f2 + F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 + F src/tokenize.c 9f7d39da1a1346fa0cf106ea0bf10bb6b8b61ddf + F src/trigger.c d46f9389e3bf3dd1cc1d288aba2f289c96b34200 + F src/update.c c0dc6b75ad28b76b619042d934f337b02acee208 + F src/utf.c dad16adcc0c35ef2437dca125a4b07419d361052 + F src/util.c ad4f03079ba0fe83590d1cc9197e8e4844e38592 + F src/vacuum.c 03309a08d549f9389cc3a3589afd4fadbdaf0679 + F src/vdbe.c 5ed06318aac5d57849170a8bf39e807c22c5fedd + F src/vdbe.h bea1f0cd530775bdb58a340265f3cf3ee920e9b2 + F src/vdbeInt.h d7ea821ac7813c9bea0fe87558c35e07b2c7c44d -F src/vdbeapi.c bb128b819b9ef1a2ce211a36a6cb70a1643fa239 ++F src/vdbeapi.c 52739f95b7f6a5ba013638673cf77e0c59dc0eca + F src/vdbeaux.c 0981dcb5b933b74ae7bc9bfa7770df5e4da849b3 + F src/vdbeblob.c 84f924700a7a889152aeebef77ca5f4e3875ffb4 + F src/vdbemem.c 1e16e3a16e55f4c3452834f0e041726021aa66e0 + F src/vdbetrace.c 864cef96919323482ebd9986f2132435115e9cc2 + F src/vtab.c 456fc226614569f0e46f216e33265bea268bd917 + F src/walker.c 3112bb3afe1d85dc52317cb1d752055e9a781f8f + F src/where.c 11b5b00c49d53e767a7eb855bc60790edeca6185 F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2 F test/alias.test 4529fbc152f190268a15f9384a5651bbbabc9d87 F test/all.test 14165b3e32715b700b5f0cbf8f6e3833dda0be45 @@@ -234,7 -239,7 +242,7 @@@ F test/async2.test bf5e2ca2c96763b4cba3 F test/async3.test 93edaa9122f498e56ea98c36c72abc407f4fb11e F test/async4.test aafa6328c559d3e4bb587de770cbdecfca06f0da F test/async5.test f3592d79c84d6e83a5f50d3fd500445f7d97dfdf - F test/attach.test 5519fbeb99b77d342642e9b990a644149c3ae9d1 -F test/attach.test 826f7676c41c12b035181d257299b8c8a17d64f3 ++F test/attach.test ebbaeb5032fb7a0a3eb8b5a4b41656da8b35e661 F test/attach2.test a295d2d7061adcee5884ef4a93c7c96a82765437 F test/attach3.test bd9830bc3a0d22ed1310c9bff6896927937017dc F test/attachmalloc.test cf8cf17d183de357b1147a9baacbdfc85b940b61 @@@ -510,12 -521,12 +525,12 @@@ F test/pagesize.test 0d9ff3fedfce6e5ffe F test/pcache.test eebc4420b37cb07733ae9b6e99c9da7c40dd6d58 F test/pcache2.test 0d85f2ab6963aee28c671d4c71bec038c00a1d16 F test/permutations.test 1ce2874df8fec876d0b963c7a3ef61c4e9df8827 -F test/pragma.test 5aeb48a442dba3c3e8e38773b121371814ab3b17 +F test/pragma.test 648a1760925d7d39003b3fd29e1b050c983e7553 F test/pragma2.test 5364893491b9231dd170e3459bfc2e2342658b47 - F test/printf.test 47e9e5bbec8509023479d54ceb71c9d05a95308a + F test/printf.test 05970cde31b1a9f54bd75af60597be75a5c54fea F test/progress.test 5b075c3c790c7b2a61419bc199db87aaf48b8301 F test/ptrchng.test ef1aa72d6cf35a2bbd0869a649b744e9d84977fc - F test/quick.test 5ac8be9487553d9e38433ad70d6906b87d558de3 -F test/quick.test d6591e74f3ac19da7fd076845f06dca48fd43cff ++F test/quick.test c95f12579f93cf255d3c12f695185feec927175a F test/quote.test 215897dbe8de1a6f701265836d6601cc6ed103e6 F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459 F test/randexpr1.test 1084050991e9ba22c1c10edd8d84673b501cc25a @@@ -579,7 -590,7 +594,7 @@@ F test/tclsqlite.test bf4227eb236a4c097 F test/tempdb.test 1bf52da28a9c24e29717362a87722dff08feb72b F test/temptable.test f42121a0d29a62f00f93274464164177ab1cc24a F test/temptrigger.test b0273db072ce5f37cf19140ceb1f0d524bbe9f05 - F test/tester.tcl 0fbba238815429131181774ba2b169e198838150 -F test/tester.tcl 02f671e71d1646440d226bed2dde8433f0a7bfa9 ++F test/tester.tcl 6ae75e1f0b9e350279c627f467e9e04877032c5c F test/thread001.test a3e6a7254d1cb057836cb3145b60c10bf5b7e60f F test/thread002.test afd20095e6e845b405df4f2c920cb93301ca69db F test/thread003.test b824d4f52b870ae39fc5bae4d8070eca73085dca @@@ -749,7 -761,7 +765,7 @@@ F tool/lempar.c 01ca97f87610d1dac6d8cd9 F tool/mkkeywordhash.c 9216336085e7a7c226a35c0bd780239968f8304f F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 - F tool/mksqlite3c.tcl 1ac077b7bf1cca4e4922b5e72a5e898274fb174b -F tool/mksqlite3c.tcl 1da28229695fdebdfe8a7d19902ef6c76d6c1c2d ++F tool/mksqlite3c.tcl 4478ffa3ed3fee37f753dae92af4054d9425c80f F tool/mksqlite3h.tcl eb100dce83f24b501b325b340f8b5eb8e5106b3b F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87 F tool/omittest.tcl 27d6f6e3b1e95aeb26a1c140e6eb57771c6d794a @@@ -765,7 -779,14 +783,14 @@@ F tool/speedtest2.tcl ee2149167303ba8e9 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f - P 9552de8fb5ec7554c989edc138c0324c5fd0a206 - R c261e4bb35de3147ded75b7a34bb1974 - U adam - Z 70f10dd51ab98fc01c03c41ffe1c04c0 -P cd50acf37fd1e3b388f98fb2df7ed03cff454b24 -R 5d0b6a47a50c8a9cdc60d3d4d61a8cf2 ++P 62f15c0aeaec5d778addb6edba62411c698bec0f 1ed88e9d01e9eda5cbc622e7614277f29bcc551c ++R cf1909366cf2795f7cddf4999bd047be + U drh -Z 8b76b0c0726e570aef93558fa0c3fdc7 ++Z af56e8a859d9915d17c32b5351556778 + -----BEGIN PGP SIGNATURE----- + Version: GnuPG v1.4.6 (GNU/Linux) + -iD8DBQFLHS+0oxKgR168RlERArAKAJ97NTyJvzQHmWC2GXt2Xt7D52m04QCeLeQt -HYPTNDWgvT/KRZ19RtHNjDQ= -=tE2+ ++iD8DBQFLHZWUoxKgR168RlERAgy2AJ94edIz+IyLZu6fvBeDJoxlOOqJjACghqTo ++MgOO8nXoLVYOCyukTpPgmZo= ++=X5W4 + -----END PGP SIGNATURE----- diff --cc manifest.uuid index 0b14668256,b4e4637fcf..2db0dfbec4 --- a/manifest.uuid +++ b/manifest.uuid @@@ -1,1 -1,1 +1,1 @@@ - 62f15c0aeaec5d778addb6edba62411c698bec0f -1ed88e9d01e9eda5cbc622e7614277f29bcc551c ++ad08794d7239bb804eb39c00170821732b60cb65 diff --cc src/func.c index 0d93b1a781,8cb7a037c0..246888b0fa --- a/src/func.c +++ b/src/func.c @@@ -186,14 -189,12 +189,15 @@@ static void substrFunc z = sqlite3_value_text(argv[0]); if( z==0 ) return; len = 0; - for(z2=z; *z2; len++){ - SQLITE_SKIP_UTF8(z2); + if( p1<0 ){ + for(z2=z; *z2; len++){ + SQLITE_SKIP_UTF8(z2); + } } } - p1 = sqlite3_value_int(argv[1]); +#ifdef SQLITE_SUBSTR_COMPATIBILITY + if( p1==0 ) p1 = 1; /* */ +#endif if( argc==3 ){ p2 = sqlite3_value_int(argv[2]); if( p2<0 ){ diff --cc src/os_unix.c index 6075fbe98f,d7a9d8ec54..0e4a219ce1 --- a/src/os_unix.c +++ b/src/os_unix.c @@@ -2555,8 -2456,7 +2555,8 @@@ static int afpCheckReservedLock(sqlite3 } } + unixLeaveMutex(); - OSTRACE4("TEST WR-LOCK %d %d %d\n", pFile->h, rc, reserved); + OSTRACE4("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved); *pResOut = reserved; return rc; @@@ -2593,9 -2492,8 +2593,9 @@@ static int afpLock(sqlite3_file *id, in afpLockingContext *context = (afpLockingContext *) pFile->lockingContext; assert( pFile ); - OSTRACE7("LOCK %d %s was %s(%s,%d) pid=%d\n", pFile->h, - OSTRACE5("LOCK %d %s was %s pid=%d (afp)\n", pFile->h, - locktypeName(locktype), locktypeName(pFile->locktype), getpid()); ++ OSTRACE7("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h, + locktypeName(locktype), locktypeName(pFile->locktype), + locktypeName(pLock->locktype), pLock->cnt , getpid()); /* If there is already a lock of this type or more restrictive on the ** unixFile, do nothing. Don't use the afp_end_lock: exit path, as @@@ -2627,33 -2522,7 +2627,33 @@@ unixLeaveMutex(); return rc; } + pLock = pFile->pLock; + + /* If some thread using this PID has a lock via a different unixFile* + ** handle that precludes the requested lock, return BUSY. + */ + if( (pFile->locktype!=pLock->locktype && + (pLock->locktype>=PENDING_LOCK || locktype>SHARED_LOCK)) + ){ + rc = SQLITE_BUSY; + goto afp_end_lock; + } + + /* If a SHARED lock is requested, and some thread using this PID already + ** has a SHARED or RESERVED lock, then increment reference counts and + ** return SQLITE_OK. + */ + if( locktype==SHARED_LOCK && + (pLock->locktype==SHARED_LOCK || pLock->locktype==RESERVED_LOCK) ){ + assert( locktype==SHARED_LOCK ); + assert( pFile->locktype==0 ); + assert( pLock->cnt>0 ); + pFile->locktype = SHARED_LOCK; + pLock->cnt++; + pFile->pOpen->nLock++; + goto afp_end_lock; + } - + /* A PENDING lock is needed before acquiring a SHARED lock and before ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will ** be released. @@@ -2673,19 -2542,15 +2673,19 @@@ ** operating system calls for the specified lock. */ if( locktype==SHARED_LOCK ){ - int lk, lrc1, lrc2; - int lrc1Errno = 0; + int lrc1, lrc2, lrc1Errno; + long lk, mask; + assert( pLock->cnt==0 ); + assert( pLock->locktype==0 ); + + mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff; /* Now get the read-lock SHARED_LOCK */ /* note that the quality of the randomness doesn't matter that much */ - lk = random(); + lk = random(); - context->sharedByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1); + pLock->sharedByte = (lk & mask)%(SHARED_SIZE - 1); lrc1 = afpSetLock(context->dbPath, pFile, - SHARED_FIRST+context->sharedByte, 1, 1); + SHARED_FIRST+pLock->sharedByte, 1, 1); if( IS_LOCK_ERROR(lrc1) ){ lrc1Errno = pFile->lastErrno; } @@@ -2779,16 -2634,11 +2779,16 @@@ afp_end_lock static int afpUnlock(sqlite3_file *id, int locktype) { int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; - afpLockingContext *pCtx = (afpLockingContext *) pFile->lockingContext; + struct unixLockInfo *pLock; + afpLockingContext *context = (afpLockingContext *) pFile->lockingContext; + int skipShared = 0; +#ifdef SQLITE_TEST + int h = pFile->h; +#endif - + assert( pFile ); - OSTRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d\n", pFile->h, locktype, - OSTRACE5("UNLOCK %d %d was %d pid=%d (afp)\n", pFile->h, locktype, - pFile->locktype, getpid()); ++ OSTRACE7("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, locktype, + pFile->locktype, pFile->pLock->locktype, pFile->pLock->cnt, getpid()); assert( locktype<=SHARED_LOCK ); if( pFile->locktype<=locktype ){ @@@ -3237,11 -3015,7 +3237,11 @@@ static int full_fsync(int fd, int fullS */ if( rc ) rc = fsync(fd); +#elif defined(__APPLE__) + // fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly + // so currently we default to the macro that redefines fdatasync to fsync + rc = fsync(fd); - #else + #else rc = fdatasync(fd); #if OS_VXWORKS if( rc==-1 && errno==ENOTSUP ){ @@@ -4083,8 -3867,7 +4096,8 @@@ static int unixOpen int isCreate = (flags & SQLITE_OPEN_CREATE); int isReadonly = (flags & SQLITE_OPEN_READONLY); int isReadWrite = (flags & SQLITE_OPEN_READWRITE); + int isAutoProxy = (flags & SQLITE_OPEN_AUTOPROXY); - + /* If creating a master or main-file journal, this function will open ** a file-descriptor on the directory too. The first time unixSync() ** is called the directory file descriptor will be fsync()ed and close()d. @@@ -5155,190 -4795,120 +5168,190 @@@ static int proxyTakeConch(unixFile *pFi if( rc!=SQLITE_OK ){ goto end_takeconch; } - - readRc = unixRead((sqlite3_file *)conchFile, conchValue, CONCHLEN, 0); - if( readRc!=SQLITE_IOERR_SHORT_READ ){ - if( readRc!=SQLITE_OK ){ - if( (rc&0xff)==SQLITE_IOERR ){ - pFile->lastErrno = conchFile->lastErrno; + /* read the existing conch file */ + readLen = seekAndRead((unixFile*)conchFile, 0, readBuf, PROXY_MAXCONCHLEN); + if( readLen<0 ){ + /* I/O error: lastErrno set by seekAndRead */ + pFile->lastErrno = conchFile->lastErrno; + rc = SQLITE_IOERR_READ; + goto end_takeconch; + }else if( readLen<=(PROXY_HEADERLEN+PROXY_HOSTIDLEN) || + readBuf[0]!=(char)PROXY_CONCHVERSION ){ + /* a short read or version format mismatch means we need to create a new + ** conch file. + */ + createConch = 1; + } + /* if the host id matches and the lock path already exists in the conch + ** we'll try to use the path there, if we can't open that path, we'll + ** retry with a new auto-generated path + */ + do { /* in case we need to try again for an :auto: named lock file */ + + if( !createConch && !forceNewLockPath ){ + hostIdMatch = !memcmp(&readBuf[PROXY_HEADERLEN], myHostID, + PROXY_HOSTIDLEN); + /* if the conch has data compare the contents */ + if( !pCtx->lockProxyPath ){ + /* for auto-named local lock file, just check the host ID and we'll + ** use the local lock file path that's already in there + */ + if( hostIdMatch ){ + size_t pathLen = (readLen - PROXY_PATHINDEX); + + if( pathLen>=MAXPATHLEN ){ + pathLen=MAXPATHLEN-1; + } + memcpy(lockPath, &readBuf[PROXY_PATHINDEX], pathLen); + lockPath[pathLen] = 0; + tempLockPath = lockPath; + tryOldLockPath = 1; + /* create a copy of the lock path if the conch is taken */ + goto end_takeconch; + } + }else if( hostIdMatch && !strncmp(pCtx->lockProxyPath, + &readBuf[PROXY_PATHINDEX], readLen-PROXY_PATHINDEX) ){ + /* conch host and lock path match */ + goto end_takeconch; } - rc = readRc; + } + + /* if the conch isn't writable and doesn't match, we can't take it */ + if( (conchFile->openFlags&O_RDWR) == 0 ){ + rc = SQLITE_BUSY; goto end_takeconch; } - /* if the conch has data compare the contents */ + + /* either the conch didn't match or we need to create a new one */ if( !pCtx->lockProxyPath ){ - /* for auto-named local lock file, just check the host ID and we'll - ** use the local lock file path that's already in there */ - if( !memcmp(testValue, conchValue, HOSTIDLEN) ){ - tLockPath = (char *)&conchValue[HOSTIDLEN]; - goto end_takeconch; + proxyGetLockPath(pCtx->dbPath, lockPath, MAXPATHLEN); + tempLockPath = lockPath; + /* create a copy of the lock path _only_ if the conch is taken */ + } + + /* update conch with host and path (this will fail if other process + ** has a shared lock already), if the host id matches, use the big + ** stick. + */ + futimes(conchFile->h, NULL); + if( hostIdMatch && !createConch ){ + if( conchFile->pLock && conchFile->pLock->cnt>1 ){ + /* We are trying for an exclusive lock but another thread in this + ** same process is still holding a shared lock. */ + rc = SQLITE_BUSY; + } else { + rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK); } }else{ - /* we've got the conch if conchValue matches our path and host ID */ - if( !memcmp(testValue, conchValue, CONCHLEN) ){ - goto end_takeconch; - } + rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, EXCLUSIVE_LOCK); } - }else{ - /* a short read means we're "creating" the conch (even though it could - ** have been user-intervention), if we acquire the exclusive lock, - ** we'll try to match the current on-disk permissions of the database - */ - syncPerms = 1; - } - - /* either conch was emtpy or didn't match */ - if( !pCtx->lockProxyPath ){ - proxyGetLockPath(pCtx->dbPath, lockPath, MAXPATHLEN); - tLockPath = lockPath; - strlcpy(&testValue[HOSTIDLEN], lockPath, MAXPATHLEN); - } - - /* update conch with host and path (this will fail if other process - ** has a shared lock already) */ - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, EXCLUSIVE_LOCK); - if( rc==SQLITE_OK ){ - rc = unixWrite((sqlite3_file *)conchFile, testValue, CONCHLEN, 0); - if( rc==SQLITE_OK && syncPerms ){ - struct stat buf; - int err = fstat(pFile->h, &buf); - if( err==0 ){ - /* try to match the database file permissions, ignore failure */ + if( rc==SQLITE_OK ){ + char writeBuffer[PROXY_MAXCONCHLEN]; + int writeSize = 0; + + writeBuffer[0] = (char)PROXY_CONCHVERSION; + memcpy(&writeBuffer[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN); + if( pCtx->lockProxyPath!=NULL ){ + strlcpy(&writeBuffer[PROXY_PATHINDEX], pCtx->lockProxyPath, MAXPATHLEN); + }else{ + strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN); + } + writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]); + ftruncate(conchFile->h, writeSize); + rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0); + fsync(conchFile->h); + /* If we created a new conch file (not just updated the contents of a + ** valid conch file), try to match the permissions of the database + */ + if( rc==SQLITE_OK && createConch ){ + struct stat buf; + int err = fstat(pFile->h, &buf); + if( err==0 ){ + mode_t cmode = buf.st_mode&(S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP | + S_IROTH|S_IWOTH); + /* try to match the database file R/W permissions, ignore failure */ #ifndef SQLITE_PROXY_DEBUG - fchmod(conchFile->h, buf.st_mode); + fchmod(conchFile->h, cmode); #else - if( fchmod(conchFile->h, buf.st_mode)!=0 ){ + if( fchmod(conchFile->h, cmode)!=0 ){ + int code = errno; + fprintf(stderr, "fchmod %o FAILED with %d %s\n", + cmode, code, strerror(code)); + } else { + fprintf(stderr, "fchmod %o SUCCEDED\n",cmode); + } + }else{ int code = errno; - fprintf(stderr, "fchmod %o FAILED with %d %s\n", - buf.st_mode, code, strerror(code)); - } else { - fprintf(stderr, "fchmod %o SUCCEDED\n",buf.st_mode); - } - }else{ - int code = errno; - fprintf(stderr, "STAT FAILED[%d] with %d %s\n", - err, code, strerror(code)); + fprintf(stderr, "STAT FAILED[%d] with %d %s\n", + err, code, strerror(code)); #endif + } } } - } - conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK); - -end_takeconch: - OSTRACE2("TRANSPROXY: CLOSE %d\n", pFile->h); - if( rc==SQLITE_OK && pFile->openFlags ){ - if( pFile->h>=0 ){ + conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK); + + end_takeconch: + OSTRACE2("TRANSPROXY: CLOSE %d\n", pFile->h); + if( rc==SQLITE_OK && pFile->openFlags ){ + if( pFile->h>=0 ){ #ifdef STRICT_CLOSE_ERROR - if( close(pFile->h) ){ - pFile->lastErrno = errno; - return SQLITE_IOERR_CLOSE; - } + if( close(pFile->h) ){ + pFile->lastErrno = errno; + return SQLITE_IOERR_CLOSE; + } #else - close(pFile->h); /* silently leak fd if fail */ + close(pFile->h); /* silently leak fd if fail */ #endif + } + pFile->h = -1; + int fd = open(pCtx->dbPath, pFile->openFlags, + SQLITE_DEFAULT_FILE_PERMISSIONS); + OSTRACE2("TRANSPROXY: OPEN %d\n", fd); + if( fd>=0 ){ + pFile->h = fd; + }else{ + rc=SQLITE_CANTOPEN; /* SQLITE_BUSY? proxyTakeConch called + during locking */ + } } - pFile->h = -1; - int fd = open(pCtx->dbPath, pFile->openFlags, - SQLITE_DEFAULT_FILE_PERMISSIONS); - OSTRACE2("TRANSPROXY: OPEN %d\n", fd); - if( fd>=0 ){ - pFile->h = fd; - }else{ - rc=SQLITE_CANTOPEN; /* SQLITE_BUSY? proxyTakeConch called - during locking */ + if( rc==SQLITE_OK && !pCtx->lockProxy ){ + char *path = tempLockPath ? tempLockPath : pCtx->lockProxyPath; + rc = proxyCreateUnixFile(path, &pCtx->lockProxy, 1); + if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM && tryOldLockPath ){ + /* we couldn't create the proxy lock file with the old lock file path + ** so try again via auto-naming + */ + forceNewLockPath = 1; + tryOldLockPath = 0; + continue; // go back to the do {} while start point, try again + } } - } - if( rc==SQLITE_OK && !pCtx->lockProxy ){ - char *path = tLockPath ? tLockPath : pCtx->lockProxyPath; - /* ACS: Need to make a copy of path sometimes */ - rc = proxyCreateUnixFile(path, &pCtx->lockProxy); - } - if( rc==SQLITE_OK ){ - pCtx->conchHeld = 1; - - if( tLockPath ){ - pCtx->lockProxyPath = sqlite3DbStrDup(0, tLockPath); + if( rc==SQLITE_OK ){ + /* Need to make a copy of path if we extracted the value + ** from the conch file or the path was allocated on the stack + */ + if( tempLockPath ){ + pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath); + if( !pCtx->lockProxyPath ){ + rc = SQLITE_NOMEM; + } + } + } + if( rc==SQLITE_OK ){ + pCtx->conchHeld = 1; + if( pCtx->lockProxy->pMethod == &afpIoMethods ){ - ((afpLockingContext *)pCtx->lockProxy->lockingContext)->dbPath = - pCtx->lockProxyPath; + afpLockingContext *afpCtx; + afpCtx = (afpLockingContext *)pCtx->lockProxy->lockingContext; + afpCtx->dbPath = pCtx->lockProxyPath; } + } else { + conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK); } - } else { - conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK); - } - OSTRACE3("TAKECONCH %d %s\n", conchFile->h, rc==SQLITE_OK?"ok":"failed"); - return rc; + OSTRACE3("TAKECONCH %d %s\n", conchFile->h, rc==SQLITE_OK?"ok":"failed"); + return rc; + } while (1); /* in case we need to retry the :auto: lock file - we should never get here except via the 'continue' call. */ - } + } } /* @@@ -5504,29 -5072,8 +5517,29 @@@ static int proxyTransformUnixFile(unixF rc = proxyCreateConchPathname(dbPath, &pCtx->conchFilePath); if( rc==SQLITE_OK ){ - rc = proxyCreateUnixFile(pCtx->conchFilePath, &pCtx->conchFile); + rc = proxyCreateUnixFile(pCtx->conchFilePath, &pCtx->conchFile, 0); + if( rc==SQLITE_CANTOPEN && ((pFile->openFlags&O_RDWR) == 0) ){ + /* if (a) the open flags are not O_RDWR, (b) the conch isn't there, and + ** (c) the file system is read-only, then enable no-locking access. + ** Ugh, since O_RDONLY==0x0000 we test for !O_RDWR since unixOpen asserts + ** that openFlags will have only one of O_RDONLY or O_RDWR. + */ + struct statfs fsInfo; + struct stat conchInfo; + int goLockless = 0; + + if( stat(pCtx->conchFilePath, &conchInfo) == -1 ) { + int err = errno; + if( (err==ENOENT) && (statfs(dbPath, &fsInfo) != -1) ){ + goLockless = (fsInfo.f_flags&MNT_RDONLY) == MNT_RDONLY; + } + } + if( goLockless ){ + pCtx->conchHeld = -1; /* read only FS/ lockless */ + rc = SQLITE_OK; + } + } - } + } if( rc==SQLITE_OK && lockPath ){ pCtx->lockProxyPath = sqlite3DbStrDup(0, lockPath); } diff --cc src/prepare.c index ee963dd2bc,0789ca507b..9232100aa3 --- a/src/prepare.c +++ b/src/prepare.c @@@ -12,13 -12,8 +12,11 @@@ ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. - ** - ** $Id: prepare.c,v 1.131 2009/08/06 17:43:31 drh Exp $ */ #include "sqliteInt.h" +#ifdef SQLITE_ENABLE_SQLRR +# include "sqlrr.h" +#endif /* ** Fill the InitData structure with an error message that indicates diff --cc tool/mksqlite3c.tcl index 85fc49b907,c14df4e8af..e73f9fe695 --- a/tool/mksqlite3c.tcl +++ b/tool/mksqlite3c.tcl @@@ -299,8 -301,7 +302,8 @@@ foreach file rtree.c icu.c - fts3_icu.c + fts3_icu.c + sqlrr.c } { copy_file tsrc/$file }