From: drh Date: Tue, 11 Oct 2011 18:38:13 +0000 (+0000) Subject: Simplify the readonly_shm implementation so that it conforms to the X-Git-Tag: mountain-lion~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa09d0503dce1c427f393db3fb1d2c780213e7df;p=thirdparty%2Fsqlite.git Simplify the readonly_shm implementation so that it conforms to the implementation on trunk. Update the test cases to agree with the new behavior. FossilOrigin-Name: 9efb74cefb2b7444112e16f3da48d5645746fdfa --- diff --git a/manifest b/manifest index bb5dd4499e..81c3bc5d93 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\slocking\serror\sintroduced\swhen\sporting\sthe\snew\sApple\slocking\scode. -D 2011-10-11T15:03:45.466 +C Simplify\sthe\sreadonly_shm\simplementation\sso\sthat\sit\sconforms\sto\sthe\nimplementation\son\strunk.\s\sUpdate\sthe\stest\scases\sto\sagree\swith\sthe\snew\nbehavior. +D 2011-10-11T18:38:13.545 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in acb1a0b8fe8029196afe437f64ead3301731b6f0 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -168,7 +168,7 @@ F src/os.c 0668c16ae226cd58cef8240e5edbd0c93248739e F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h 92815ed65f805560b66166e3583470ff94478f04 F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 -F src/os_unix.c c254695c7394013990bbb280f82efbfb10b93c20 +F src/os_unix.c cf2d13380093f2c4fa89f86c299178481776c881 F src/os_win.c 2d6f0e6f7df4742ef4714d52f6dac2742580204e F src/pager.c b23e50bc7aa99e3b264537243a4f5cd2663d0734 F src/pager.h dbcaa791e8b6c3a6b77c168c5c27deec289fb176 @@ -910,7 +910,7 @@ F test/walhook.test c934ac5219fee2b4e7653d291db9107b8dc73bba F test/walmode.test 9308ffc25555a1c4eaa44a863792240406637496 F test/walnoshm.test 84ca10c544632a756467336b7c3b864d493ee496 F test/walpersist.test fd40d33765b2693f721c90c66d97f99757559006 -F test/walro.test 4549618ff78efd6f9d042f3e6b17afe83a610526 +F test/walro.test e6bb27762c9f22601cbb8bff6e0acfd124e74b63 F test/walshared.test 0befc811dcf0b287efae21612304d15576e35417 F test/walslow.test 3c2475d7672511380d33cef1924a065d2ad62ff0 F test/walthread.test 3decc7e72594e0270dc1a1cc0984d6db7165b4cc @@ -971,7 +971,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5 F tool/tostr.awk e75472c2f98dd76e06b8c9c1367f4ab07e122d06 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 -P 7e2c4898224f9fabf724a6d4e1ac597845a66f73 -R aeb09b5626de90d270de451c2079a3c3 +P cce1f521362a87cc46fc5bfba68b7c188e2ea34f +R 6248c52db8063a12ed87719b7770c516 U drh -Z af9063b7e9882f71b77f0b12c1ab5c00 +Z d5d2cbe7994f9774b3181fd3344ad8bf diff --git a/manifest.uuid b/manifest.uuid index 04fb33f930..8300a3850b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -cce1f521362a87cc46fc5bfba68b7c188e2ea34f \ No newline at end of file +9efb74cefb2b7444112e16f3da48d5645746fdfa \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index 0fb8ac39f7..5e778f144a 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4707,27 +4707,16 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ if( pInode->bProcessLock==0 ){ const char *zRO; + int openFlags = O_RDWR | O_CREAT; zRO = sqlite3_uri_parameter(pDbFd->zPath, "readonly_shm"); if( zRO && sqlite3GetBoolean(zRO) ){ - pShmNode->h = robust_open(zShmFilename, O_RDONLY, - (sStat.st_mode & 0777)); + openFlags = O_RDONLY; pShmNode->isReadonly = 1; - }else{ - pShmNode->h = robust_open(zShmFilename, O_RDWR|O_CREAT, - (sStat.st_mode & 0777)); } + pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777)); if( pShmNode->h<0 ){ - const char *zRO; - zRO = sqlite3_uri_parameter(pDbFd->zPath, "readonly_shm"); - if( zRO && sqlite3GetBoolean(zRO) ){ - pShmNode->h = robust_open(zShmFilename, O_RDONLY, - (sStat.st_mode & 0777)); - pShmNode->isReadonly = 1; - } - if( pShmNode->h<0 ){ - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename); - goto shm_open_err; - } + rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename); + goto shm_open_err; } /* Check to see if another process is holding the dead-man switch. diff --git a/test/walro.test b/test/walro.test index a39ed7fe1d..3ae7d53cd9 100644 --- a/test/walro.test +++ b/test/walro.test @@ -24,13 +24,6 @@ if {$::tcl_platform(platform) != "unix"} { return } -# these tests can't deal with the location of the -shm file under proxy locking -# -if {[forced_proxy_locking]} { - finish_test - return -} - # And only if the build is WAL-capable. # ifcapable !wal { @@ -150,7 +143,7 @@ do_multiclient_test tn { } {1 {unable to open database file}} # Also test that if the -shm file can be opened for read/write access, - # it is, even if readonly_shm=1 is present in the URI. + # it is not if readonly_shm=1 is present in the URI. do_test 1.3.2.1 { code1 { db close } code2 { db2 close } @@ -158,8 +151,8 @@ do_multiclient_test tn { } {0} do_test 1.3.2.2 { code1 { sqlite3 db file:test.db?readonly_shm=1 } - sql1 { SELECT * FROM t1 } - } {a b c d e f g h i j k l} + csql1 { SELECT * FROM sqlite_master } + } {1 {unable to open database file}} do_test 1.3.2.3 { code1 { db close } close [open test.db-shm w]