From: dan Date: Thu, 5 May 2011 18:53:48 +0000 (+0000) Subject: Have the xFullpath method in os_win.c discard the initial "/" if a filename begins... X-Git-Tag: version-3.7.7~129^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4d7a4461e23f15deb6e3879273faf9dd614757a2;p=thirdparty%2Fsqlite.git Have the xFullpath method in os_win.c discard the initial "/" if a filename begins with "/X:", where X is any alphabetic character. Also fix some test issues in uri.test. FossilOrigin-Name: fe57a8f621944fd2af5a4e9349c8fd77c4aba237 --- diff --git a/manifest b/manifest index 32e0f8fc68..b62b84089c 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sproblem\sin\sthe\sURI\scode\spreventing\sthe\samalgamation\sfrom\sbuilding.\sAdd\scomments\sdescribing\sSQLITE_CONFIG_URI\sand\sSQLITE_OPEN_URI\sto\ssqlite.h.in. -D 2011-05-05T12:35:33.316 +C Have\sthe\sxFullpath\smethod\sin\sos_win.c\sdiscard\sthe\sinitial\s"/"\sif\sa\sfilename\sbegins\swith\s"/X:",\swhere\sX\sis\sany\salphabetic\scharacter.\sAlso\sfix\ssome\stest\sissues\sin\suri.test. +D 2011-05-05T18:53:48.721 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 7a4d9524721d40ef9ee26f93f9bd6a51dba106f2 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -164,7 +164,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9 F src/os_common.h a8f95b81eca8a1ab8593d23e94f8a35f35d4078f F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440 F src/os_unix.c 2c67d126874b78eb427371db4793f0e8fbc7448b -F src/os_win.c 4271f0bf733c0b45635ddcfb41c935573de8284c +F src/os_win.c ff0e14615a5086fa5ba6926e4ec0dc9cfb5a1a84 F src/pager.c 24b689bc3639d534f5fb292d2c68038b1e720527 F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1 F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58 @@ -840,7 +840,7 @@ F test/unique.test 083c7fff74695bcc27a71d75699deba3595bc9c2 F test/unixexcl.test 9d80a54d86d2261f660758928959368ffc36151e F test/unordered.test e81169ce2a8f31b2c6b66af691887e1376ab3ced F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172 -F test/uri.test 858abdea53ac46844d52ba953fba78f15f0a463a +F test/uri.test f21a5cd025ccedf0c6d4c5e365bb47e163098c04 F test/utf16align.test 54cd35a27c005a9b6e7815d887718780b6a462ae F test/vacuum.test 29b60e8cc9e573b39676df6c4a75fe9e02d04a09 F test/vacuum2.test 91a84c9b08adfc4472097d2e8deb0150214e0e76 @@ -934,7 +934,7 @@ F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/split-sqlite3c.tcl d9be87f1c340285a3e081eb19b4a247981ed290c F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P af279f367e01732560b8b2b6aeb5ede4f04415dd -R b650932bbc0e364498f81d36888b653d +P ea562d6d67c2f2ef8baca02a77634c21b945196f +R ab4f619c8bbf9faf6cdcf553d75032d8 U dan -Z 505d1fe8270a91e9ebfb3524cd8d9a43 +Z d81fc059a3e07abc471a058222e61ec9 diff --git a/manifest.uuid b/manifest.uuid index 9a80005ad0..1014b9c417 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ea562d6d67c2f2ef8baca02a77634c21b945196f \ No newline at end of file +fe57a8f621944fd2af5a4e9349c8fd77c4aba237 \ No newline at end of file diff --git a/src/os_win.c b/src/os_win.c index 4e91f7ab32..1300b90143 100644 --- a/src/os_win.c +++ b/src/os_win.c @@ -2465,6 +2465,13 @@ static int winFullPathname( void *zConverted; char *zOut; + /* If this path name begins with "/X:", where "X" is any alphabetic + ** character, discard the initial "/" from the pathname. + */ + if( zRelative[0]=='/' && sqlite3Isalpha(zRelative[1]) && zRelative[2]==':' ){ + zRelative++; + } + /* It's odd to simulate an io-error here, but really this is just ** using the io-error infrastructure to test that SQLite handles this ** function failing. This function could fail if, for example, the diff --git a/test/uri.test b/test/uri.test index 2da6574204..b8b83e8fd4 100644 --- a/test/uri.test +++ b/test/uri.test @@ -31,25 +31,31 @@ sqlite3_config_uri 1 # Test that file names are correctly extracted from URIs. # foreach {tn uri file} { - 1 test.db test.db - 2 file:test.db test.db - 3 file://PWD/test.db test.db - 4 file:PWD/test.db test.db - 5 file:test.db?mork=1 test.db - 6 file:test.db?mork=1&tonglor=2 test.db - 7 file:test.db?mork=1#boris test.db - 8 file:test.db#boris test.db - 9 test.db#boris test.db#boris - 10 test.db?mork=1#boris test.db?mork=1#boris - 11 file:test%2Edb test.db - 12 file file - 13 http:test.db http:test.db - 14 file://localhostPWD/test.db%3Fhello test.db?hello - 15 file:test.db%00extra test.db - 16 file:test%00.db%00extra test + 1 test.db test.db + 2 file:test.db test.db + 3 file://PWD/test.db test.db + 4 file:PWD/test.db test.db + 5 file:test.db?mork=1 test.db + 6 file:test.db?mork=1&tonglor=2 test.db + 7 file:test.db?mork=1#boris test.db + 8 file:test.db#boris test.db + 9 test.db#boris test.db#boris + 10 file:test%2Edb test.db + 11 file file + 12 http:test.db http:test.db + 13 file:test.db%00extra test.db + 14 file:test%00.db%00extra test + + 15 test.db?mork=1#boris test.db?mork=1#boris + 16 file://localhostPWD/test.db%3Fhello test.db?hello } { - set uri [string map [list PWD [pwd]] $uri] - set file [string map [list PWD [pwd]] $file] + + if {$tcl_platform(platform)=="windows"} { + if {$tn>14} break + set uri [string map [list PWD /[pwd]] $uri] + } else { + set uri [string map [list PWD [pwd]] $uri] + } forcedelete $file do_test 1.$tn.1 { file exists $file } 0 @@ -60,7 +66,7 @@ foreach {tn uri file} { do_test 1.$tn.3 { file exists $file } 0 sqlite3 db xxx.db - execsql { ATTACH $uri AS aux } + catchsql { ATTACH $uri AS aux } do_test 1.$tn.4 { file exists $file } 1 db close } @@ -69,6 +75,7 @@ foreach {tn uri file} { # Test that URI query parameters are passed through to the VFS layer # correctly. # +testvfs tvfs2 testvfs tvfs -default 1 tvfs filter xOpen tvfs script open_method @@ -79,7 +86,7 @@ foreach {tn uri kvlist} { 1 file:test.db?hello=world {hello world} 2 file:test.db?hello&world {hello {} world {}} 3 file:test.db?hello=1&world=2&vfs=tvfs {hello 1 world 2 vfs tvfs} - 4 file:test.db?hello=1&world=2&vfs=unix {} + 4 file:test.db?hello=1&world=2&vfs=tvfs2 {} 5 file:test.db?%68%65%6C%6C%6F=%77%6F%72%6C%64 {hello world} 6 file:test%00.db?hello%00extra=world%00ex {hello world} 7 file:test%00.db?hello%00=world%00 {hello world} @@ -88,9 +95,15 @@ foreach {tn uri kvlist} { 10 file:test.db?hello=%00world&xyz= {hello {} xyz {}} 11 file:test.db?=#ravada {} 12 file:test.db?&&&&&&&&hello=world&&&&&&& {hello world} + 13 test.db?&&&&&&&&hello=world&&&&&&& {} 14 http:test.db?hello&world {} } { + + if {$tcl_platform(platform) == "windows" && $tn>12} { + continue + } + set ::arglist "" set DB [sqlite3_open $uri] do_test 2.$tn.1 { set ::arglist } $kvlist @@ -103,6 +116,7 @@ foreach {tn uri kvlist} { db close } tvfs delete +tvfs2 delete #------------------------------------------------------------------------- # Test that specifying a non-existent VFS raises an error. @@ -217,6 +231,7 @@ proc tvfs2_callback {method filename args} { set ::T2([file tail $filename]) 1 } +catch {db close} eval forcedelete [glob test.db*] do_test 5.1.1 { sqlite3 db file:test.db1?vfs=tvfs1 @@ -254,7 +269,13 @@ foreach {tn uri res} { 5 "file://lbcalhost/PWD/test.db" {invalid uri authority: lbcalhost} 6 "file://x/PWD/test.db" {invalid uri authority: x} } { - set uri [string map [list PWD [string range [pwd] 1 end]] $uri] + + if {$tcl_platform(platform)=="windows"} { + set uri [string map [list PWD [string range [pwd] 3 end]] $uri] + } else { + set uri [string map [list PWD [string range [pwd] 1 end]] $uri] + } + do_test 6.$tn { set DB [sqlite3_open $uri] sqlite3_errmsg $DB