From 13b876773cea566018aa76c820971709445c8ec5 Mon Sep 17 00:00:00 2001 From: dan Date: Thu, 9 May 2019 11:45:21 +0000 Subject: [PATCH] Fix a problem with running the ".recover" command on a database that is zero pages in size. FossilOrigin-Name: 47fa65343e46c7782a173174952c637c5621e16229ece258dc7e7a556683ca0c --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/shell.c.in | 2 +- test/recover.test | 4 ++++ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/manifest b/manifest index 1fc0540f89..96481ec49b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Avoid\sreading\soutside\sa\srecord\sbuffer\swhen\sextracting\san\sSQL\svalue\sin\sthe\ssqlite_dbdata\svirtual\stable\scode. -D 2019-05-09T11:34:31.409 +C Fix\sa\sproblem\swith\srunning\sthe\s".recover"\scommand\son\sa\sdatabase\sthat\sis\szero\spages\sin\ssize. +D 2019-05-09T11:45:21.441 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -522,7 +522,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c 408632d9531ca8f1df8591f00530797daaa7bde3fe0d3211de4d431cbb99347e F src/rowset.c d977b011993aaea002cab3e0bb2ce50cf346000dff94e944d547b989f4b1fe93 F src/select.c ef860c7e5882c89c030432a6d2cf13c67d1d51fd511cf45cbdfd5c2faf44d51d -F src/shell.c.in 5d0e2b03f977a475700c4c535df74e753171d27ec4a50e1a5ec0090357008f05 +F src/shell.c.in 517b3e2aa15329f391bde567c5a4a5aa8d1eeb9d12f175cbc4b89a9dc136a4d3 F src/sqlite.h.in 0605c88d98c85fbcba8bbd9716e7cc10b361e7b21cf2375171130f577388c943 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 9ecc93b8493bd20c0c07d52e2ac0ed8bab9b549c7f7955b59869597b650dd8b5 @@ -1230,7 +1230,7 @@ F test/randexpr1.tcl 40dec52119ed3a2b8b2a773bce24b63a3a746459 F test/randexpr1.test eda062a97e60f9c38ae8d806b03b0ddf23d796df F test/rbu.test 168573d353cd0fd10196b87b0caa322c144ef736 F test/rdonly.test 64e2696c322e3538df0b1ed624e21f9a23ed9ff8 -F test/recover.test 4c45b1519c11c6d10cc28bced260e2a18f3967fc6abccaace44af6c22b30280c +F test/recover.test ccb8c2623902a92ebb76770edd075cb4f75a4760bb7afde38026572c6e79070d F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c F test/reindex.test 44edd3966b474468b823d481eafef0c305022254 @@ -1825,7 +1825,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 ec9373031d76b34163a45d0ed05e43c0c9d585c8d47aa255f670340673bc7875 -R 792bbcbe6e2a990555a162dba387f00d +P d99bb0c11d62f629bf59da037827af73a9b814e65815006e0cbca1bc41f42e25 +R 4c080fc5e9ab944c47b4a994674f6f12 U dan -Z f6d6e605cd200b1a74018499a0dcfaa6 +Z 26f5a39683d1a25b78fcdb707e769b6d diff --git a/manifest.uuid b/manifest.uuid index 5c57049f08..e1ca85ea2b 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d99bb0c11d62f629bf59da037827af73a9b814e65815006e0cbca1bc41f42e25 \ No newline at end of file +47fa65343e46c7782a173174952c637c5621e16229ece258dc7e7a556683ca0c \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index d4c6019f1f..8edf33f381 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -6621,7 +6621,7 @@ static int recoverDatabaseCmd(ShellState *pState, int nArg, char **azArg){ "WITH pages(i, maxlen) AS (" " SELECT page_count, (" " SELECT max(field+1) FROM sqlite_dbdata WHERE pgno=page_count" - " ) FROM pragma_page_count" + " ) FROM pragma_page_count WHERE page_count>0" " UNION ALL" " SELECT i-1, (" " SELECT max(field+1) FROM sqlite_dbdata WHERE pgno=i-1" diff --git a/test/recover.test b/test/recover.test index 75360bc86b..469c43b115 100644 --- a/test/recover.test +++ b/test/recover.test @@ -127,4 +127,8 @@ do_recover_test 2.4.1 { 2 2 3 {} 8 9 7 } +#------------------------------------------------------------------------- +reset_db +do_recover_test 3.0 + finish_test