From: larrybr Date: Wed, 10 May 2023 00:15:05 +0000 (+0000) Subject: Passes shell{1-8}.test . X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=90d7c2a16fef1f12397f0b584488128903a452ca;p=thirdparty%2Fsqlite.git Passes shell{1-8}.test . FossilOrigin-Name: 76734a4b6c61ab004703df40e2197e4f6e5c0b3d5937aed7ea41193ebe2721a1 --- diff --git a/manifest b/manifest index cf955d95ca..6fcc1dbf35 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C sqlite3x\sbuilds\stoo.\sFails\sa\sfew\sshell2.test\sTCL\stests. -D 2023-05-09T21:53:59.194 +C Passes\sshell{1-8}.test\s. +D 2023-05-10T00:15:05.614 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -640,7 +640,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92 F src/select.c f9333ef8181192c22662f5cb8d257efc4a2880f9ee4853c6c4616f783d27e1b5 -F src/shell.c.in 1de9f0780c1f564197254e4908b10844c4505bf98a99738b5ac123d2c775b2d1 +F src/shell.c.in e84be25a7f2a4a9bfc3fb0755000cc35726e09e81c88af28a1a380eec5c56228 F src/shext_linkage.h 27dcf7624df05b2a7a6d367834339a6db3636f3035157f641f7db2ec499f8f6d F src/sqlite.h.in 27ca1d4b2eda8feee468af5735182390e8fe4696522751eec0136d17323201ad F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 @@ -1508,7 +1508,7 @@ F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8e F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304 F test/shell1.test 62896b0179d402468b54855209cb730e9f15df4896f9ef168113e69b7eec97bf -F test/shell2.test 814a98e93b480162c6fd4fed573cff826225ebd1ed7f8b3e36a6fab0c0c303d1 +F test/shell2.test 71f2f0dbc9fc042f78bc4403b8d4cf0d5ff2ae5eb14285fdec6c1abc945bc87c F test/shell3.test 9dd38fe5d98047dca5e71a09e64272b3fb75d8131bfb9137122785ed2c8c3802 F test/shell4.test 8116d7b9dbefe6e2237908afbd6738637e0426486373231d3ad8984471d4e04c F test/shell5.test ec82248dda87329f7dfced8637515b68db4ee75d94c8129dc017376fb61a8247 @@ -2077,8 +2077,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 3eb194957c2b21cf017d2909725afdc2a277109c300bc420b8f090653ef986a4 -R 7242d71ca4da70b2df1d825e0e951b30 +P 2749aea2086f257f98e58d349ef67d88d355b7d02157cc07e89a1e6b62265572 +R fbc3b599c85b3746cf34731dd10d97f1 U larrybr -Z 2388d0eb47562975d48f13788572b0b7 +Z dd13c293aab5fd9ae5f70003e8cea702 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 2782dc9bc3..a560954859 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -2749aea2086f257f98e58d349ef67d88d355b7d02157cc07e89a1e6b62265572 \ No newline at end of file +76734a4b6c61ab004703df40e2197e4f6e5c0b3d5937aed7ea41193ebe2721a1 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index f689694221..d33a5a5d36 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -6457,7 +6457,7 @@ static void tryToCloneSchema( sqlite3_errmsg(DBX(psx)), zQuery); goto end_schema_xfer; } - while( sqlite3_step(pQuery)==SQLITE_ROW ){ + while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){ zName = sqlite3_column_text(pQuery, 0); zSql = sqlite3_column_text(pQuery, 1); if( zName==0 || zSql==0 ) continue; @@ -6494,7 +6494,7 @@ static void tryToCloneSchema( zName = sqlite3_column_text(pQuery, 0); zSql = sqlite3_column_text(pQuery, 1); if( zName==0 || zSql==0 ) continue; - if( sqlite3_stricmp((char*)zName, "sqlite_sequence")!=0 ) continue; + if( sqlite3_stricmp((char*)zName, "sqlite_sequence")==0 ) continue; /* Consider directing ... */ fprintf(STD_OUT, "%s... ", zName); fflush(STD_OUT); sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg); @@ -6532,12 +6532,14 @@ static void tryToClone(ShellExState *psx, const char *zNewDb){ utf8_printf(STD_ERR, "Cannot create output database: %s\n", sqlite3_errmsg(newDb)); }else{ - sqlite3_exec(DBX(psx), "PRAGMA writable_schema=ON;", 0, 0, 0); + // sqlite3_exec(DBX(psx), "PRAGMA writable_schema=ON;", 0, 0, 0); + sqlite3_db_config(newDb, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); + sqlite3_db_config(newDb, SQLITE_DBCONFIG_DEFENSIVE, 0, 0); sqlite3_exec(newDb, "BEGIN EXCLUSIVE;", 0, 0, 0); tryToCloneSchema(psx, newDb, "type='table'", tryToCloneData); tryToCloneSchema(psx, newDb, "type!='table'", 0); sqlite3_exec(newDb, "COMMIT;", 0, 0, 0); - sqlite3_exec(DBX(psx), "PRAGMA writable_schema=OFF;", 0, 0, 0); + // sqlite3_exec(DBX(psx), "PRAGMA writable_schema=OFF;", 0, 0, 0); } close_db(newDb); } @@ -15105,33 +15107,34 @@ static int runOneSqlLine(ShellExState *psx, char *zSql, if( ShellHasFlag(psx,SHFLG_Backslash) ) resolve_backslashes(zSql); if( ISS(psx)->flgProgress & SHELL_PROGRESS_RESET ) ISS(psx)->nProgress = 0; BEGIN_TIMER; - /* This shell_exec call will also echo the submitted SQL when echo is on. */ rc = shell_exec(psx, zSql, &zErrMsg); END_TIMER; if( rc || zErrMsg ){ char zPrefix[100]; const char *zErrorTail; const char *zErrorType; - if( zErrMsg==0 ){ - zErrorType = "Error"; - zErrorTail = sqlite3_errmsg(DBX(psx)); - }else if( cli_strncmp(zErrMsg, "in prepare, ",12)==0 ){ - zErrorType = "Parse error"; - zErrorTail = &zErrMsg[12]; - }else if( cli_strncmp(zErrMsg, "stepping, ", 10)==0 ){ - zErrorType = "Runtime error"; - zErrorTail = &zErrMsg[10]; - }else{ - zErrorType = "Error"; - zErrorTail = zErrMsg; - } - if( bAltIn || !stdin_is_interactive ){ - sqlite3_snprintf(sizeof(zPrefix), zPrefix, - "%s near line %d:", zErrorType, startline); - }else{ - sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%s:", zErrorType); + if( psx->shellAbruptExit==0 ){ + if( zErrMsg==0 ){ + zErrorType = "Error"; + zErrorTail = sqlite3_errmsg(DBX(psx)); + }else if( cli_strncmp(zErrMsg, "in prepare, ",12)==0 ){ + zErrorType = "Parse error"; + zErrorTail = &zErrMsg[12]; + }else if( cli_strncmp(zErrMsg, "stepping, ", 10)==0 ){ + zErrorType = "Runtime error"; + zErrorTail = &zErrMsg[10]; + }else{ + zErrorType = "Error"; + zErrorTail = zErrMsg; + } + if( bAltIn || !stdin_is_interactive ){ + sqlite3_snprintf(sizeof(zPrefix), zPrefix, + "%s near line %d:", zErrorType, startline); + }else{ + sqlite3_snprintf(sizeof(zPrefix), zPrefix, "%s:", zErrorType); + } + utf8_printf(STD_ERR, "%s %s\n", zPrefix, zErrorTail); } - utf8_printf(STD_ERR, "%s %s\n", zPrefix, zErrorTail); sqlite3_free(zErrMsg); return 1; }else if( ShellHasFlag(psx, SHFLG_CountChanges) ){ @@ -15542,7 +15545,7 @@ static DotCmdRC process_input(ShellInState *psi){ case Runnable: switch( inKind ){ case Sql: - /* runOneSqlLine() does its own echo when requested. */ + echo_group_input(psi, *pzLineUse); nErrors += runOneSqlLine(XSS(psi), *pzLineUse, INSOURCE_IS_INTERACTIVE(psi->pInSource), iStartline); @@ -15561,6 +15564,7 @@ static DotCmdRC process_input(ShellInState *psi){ char *zErr = 0; DotCmdRC dcr; assert(pSS!=0); + /* Consider: Should echo flag be honored here? */ pSS->pMethods->resetCompletionScan(pSS); dcr = pSS->pMethods->runScript(pSS, *pzLineUse+nLeadWhite, XSS(psi), &zErr); diff --git a/test/shell2.test b/test/shell2.test index 81c78e7f7c..286e9be3cc 100644 --- a/test/shell2.test +++ b/test/shell2.test @@ -192,15 +192,17 @@ do_test shell2-1.4.7 { do_test shell2-1.4.8 { catchcmd "-safe :memory:" { SELECT edit('DoNotCare');} -} {1 {line 2: cannot use the edit() function in safe mode}} +} {1 {line 2: cannot use the edit() function in safe mode +Abnormal exit (2)}} do_test shell2-1.4.9 { catchcmd "-safe :memory:" { SELECT writefile('DoNotCare', x'');} -} {1 {line 2: cannot use the writefile() function in safe mode}} +} {1 {line 2: cannot use the writefile() function in safe mode +Abnormal exit (2)}} # Verify that .clone handles sequence table. # See https://sqlite.org/forum/forumpost/71ff9e6c4c -do_test shell2-1.4.9 { +do_test shell2-1.4.10 { forcedelete clone.db set res [catchcmd :memory: [string trim { CREATE TABLE t(id INTEGER PRIMARY KEY AUTOINCREMENT); @@ -214,7 +216,7 @@ done # Verify that generate_series stays sane near 64-bit range boundaries. # See overflow report at https://sqlite.org/forum/forumpost/5d34ce5280 -do_test shell2-1.4.10 { +do_test shell2-1.4.11 { set res [catchcmd :memory: [string trim { SELECT * FROM generate_series(9223372036854775807,9223372036854775807,1); SELECT * FROM generate_series(9223372036854775807,9223372036854775807,-1); @@ -245,7 +247,7 @@ do_test shell2-1.4.10 { # Bug discovered while messing around, .import hangs with # bit 7 set in column separator. -do_test shell2-1.4.11 { +do_test shell2-1.4.12 { forcedelete dummy.csv set df [open dummy.csv w] puts $df dog,cat