From: aswift Date: Fri, 20 Jul 2007 20:25:37 +0000 (+0000) Subject: Work around an AFP file system byte-range locking error caused by opening and closing... X-Git-Tag: version-3.4.2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f6f426be4e3d32bf0f3df91bbed880bdfa06398b;p=thirdparty%2Fsqlite.git Work around an AFP file system byte-range locking error caused by opening and closing a second file descriptor on the database file as RDWR which clears the exclusive byte-range lock and results in an fcntl error when the AFP locking code attempts to clear it afterwards. This error is caused by the test harness and isn't a flaw in the sqlite or its implementation of AFP file locking. (CVS 4172) FossilOrigin-Name: b2ba3e81fb1015d6f979a490e00a45fb7d5e1a9a --- diff --git a/manifest b/manifest index 4408a567b0..88a61d0e3a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Updates\sto\sbuild\sscripts.\s\sAdded\sscripts\sfor\sbuilding\sFTS2\sshared\slibraries.\s(CVS\s4171) -D 2007-07-20T13:42:26 +C Work\saround\san\sAFP\sfile\ssystem\sbyte-range\slocking\serror\scaused\sby\sopening\sand\sclosing\sa\ssecond\sfile\sdescriptor\son\sthe\sdatabase\sfile\sas\sRDWR\swhich\sclears\sthe\sexclusive\sbyte-range\slock\sand\sresults\sin\san\sfcntl\serror\swhen\sthe\sAFP\slocking\scode\sattempts\sto\sclear\sit\safterwards.\s\sThis\serror\sis\scaused\sby\sthe\stest\sharness\sand\sisn't\sa\sflaw\sin\sthe\ssqlite\sor\sits\simplementation\sof\sAFP\sfile\slocking.\s(CVS\s4172) +D 2007-07-20T20:25:38 F Makefile.in 0c0e53720f658c7a551046442dd7afba0b72bfbe F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -226,7 +226,7 @@ F test/enc.test e54531cd6bf941ee6760be041dff19a104c7acea F test/enc2.test 45710bacfa9df29720bc84c067dfdf8c8ddfb797 F test/enc3.test 9331988b9d72decec96995c90637e87b00d747a5 F test/exclusive.test 5bc520ba366ae3d242420af025ab64d465b04706 -F test/exclusive2.test 3496656375dc88e97d704c2d5d2c93d626cb7104 +F test/exclusive2.test 62d0559b4c0c8d4ab67237e46ea6b9cdf4be03e2 F test/exclusive3.test 0e49c35b7e7cb8e7280b4ce3f0359d30b207d2ff F test/expr.test b8d63779b043dff06580fe4f3d85e5bebd067957 F test/filefmt.test 053b622009fbbb74dd37921ffad374d852c13cd8 @@ -520,7 +520,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 81a4dd07c1d7099461e9e6668433dac5d99b1f32 -R 1ad56d3b4d154f3cbb44ee4dac0e86c2 -U drh -Z 43fa5edb181c3b479ee5d344b0b5c317 +P e269f6e9f6273210259a488c356f4996d75c6436 +R 7b6e3a55107b11156db70c2325cd0bc7 +U aswift +Z 02d988ee93c619bd2875987f1ccb8b11 diff --git a/manifest.uuid b/manifest.uuid index 960abb9eca..f09c2bb212 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -e269f6e9f6273210259a488c356f4996d75c6436 \ No newline at end of file +b2ba3e81fb1015d6f979a490e00a45fb7d5e1a9a \ No newline at end of file diff --git a/test/exclusive2.test b/test/exclusive2.test index 5d458af513..f91496f025 100644 --- a/test/exclusive2.test +++ b/test/exclusive2.test @@ -10,7 +10,7 @@ #*********************************************************************** # This file implements regression tests for SQLite library. # -# $Id: exclusive2.test,v 1.6 2007/06/16 14:43:52 danielk1977 Exp $ +# $Id: exclusive2.test,v 1.7 2007/07/20 20:25:38 aswift Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -45,11 +45,28 @@ proc pagerChangeCounter {filename {new ""}} { return $ret } +proc readPagerChangeCounter {filename} { + set fd [open $filename RDONLY] + fconfigure $fd -translation binary -encoding binary + + seek $fd 24 + foreach {a b c d} [list 0 0 0 0] {} + binary scan [read $fd 4] cccc a b c d + set ret [expr ($a&0x000000FF)<<24] + incr ret [expr ($b&0x000000FF)<<16] + incr ret [expr ($c&0x000000FF)<<8] + incr ret [expr ($d&0x000000FF)<<0] + + close $fd + return $ret +} + + proc t1sig {{db db}} { execsql {SELECT count(*), md5sum(a) FROM t1} $db } do_test exclusive2-1.0 { - pagerChangeCounter test.db + readPagerChangeCounter test.db } {0} #----------------------------------------------------------------------- @@ -98,7 +115,7 @@ do_test exclusive2-1.2.1 { } {1} do_test exclusive2-1.2 { set ::sig [t1sig] - pagerChangeCounter test.db + readPagerChangeCounter test.db } {1} do_test exclusive2-1.3 { t1sig @@ -114,7 +131,7 @@ do_test exclusive2-1.5 { expr {[t1sig db2] eq $::sig} } 0 do_test exclusive2-1.6 { - pagerChangeCounter test.db + readPagerChangeCounter test.db } {2} do_test exclusive2-1.7 { pagerChangeCounter test.db 1 @@ -177,7 +194,7 @@ do_test exclusive2-2.2.1 { } {1} do_test exclusive2-2.2 { set ::sig [t1sig] - pagerChangeCounter test.db + readPagerChangeCounter test.db } {3} do_test exclusive2-2.3 { t1sig @@ -229,45 +246,45 @@ do_test exclusive2-3.0 { INSERT INTO t1 VALUES(randstr(10, 400)); COMMIT; } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {1} do_test exclusive2-3.1 { execsql { INSERT INTO t1 VALUES(randstr(10, 400)); } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {2} do_test exclusive2-3.2 { execsql { INSERT INTO t1 VALUES(randstr(10, 400)); } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {3} do_test exclusive2-3.3 { execsql { PRAGMA locking_mode = exclusive; INSERT INTO t1 VALUES(randstr(10, 400)); } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {4} do_test exclusive2-3.4 { execsql { INSERT INTO t1 VALUES(randstr(10, 400)); } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {4} do_test exclusive2-3.5 { execsql { PRAGMA locking_mode = normal; INSERT INTO t1 VALUES(randstr(10, 400)); } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {4} do_test exclusive2-3.6 { execsql { INSERT INTO t1 VALUES(randstr(10, 400)); } - pagerChangeCounter test.db + readPagerChangeCounter test.db } {5} finish_test