]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Cure CLI hang on .import with high-ASCII column separator.
authorlarrybr <larrybr@noemail.net>
Tue, 2 May 2023 18:03:25 +0000 (18:03 +0000)
committerlarrybr <larrybr@noemail.net>
Tue, 2 May 2023 18:03:25 +0000 (18:03 +0000)
FossilOrigin-Name: aac8ac631de5c5b439c48c13f5fd271d76c11b1a5fd0919dfe4506ef7725f5ab

manifest
manifest.uuid
src/shell.c.in
test/shell2.test

index abade714d56fe96695045462d1f1342bb09ed14a..f9c673affa2f1208cb5db4bcde17ef0a4c902297 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Allow\sfor\slower-case\s"nan"\sto\smean\sNaN\sin\sJSON.
-D 2023-05-02T17:33:34.239
+C Cure\sCLI\shang\son\s.import\swith\shigh-ASCII\scolumn\sseparator.
+D 2023-05-02T18:03:25.907
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -636,7 +636,7 @@ F src/random.c 606b00941a1d7dd09c381d3279a058d771f406c5213c9932bbd93d5587be4b9c
 F src/resolve.c 3e53e02ce87c9582bd7e7d22f13f4094a271678d9dc72820fa257a2abb5e4032
 F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
 F src/select.c f879cef11c462a2c37a8c906932781e384c3bb32042c355a704a043029c90d27
-F src/shell.c.in ae33222a1776ce24a1e0fe565639126e9fd6efd276af8df562d9296db53cd3d7
+F src/shell.c.in a835e8b580b771ed5a3cbaf7406b831dee4c9fc9b2bddd133c94c90ff9e2a9ba
 F src/sqlite.h.in d6b0b83b2deab8f92ef7cc6f6fb94fa59d21c59f7b55f4c693bfff161ce42238
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h da473ce2b3d0ae407a6300c4a164589b9a6bfdbec9462688a8593ff16f3bb6e4
@@ -1501,7 +1501,7 @@ F test/sharedB.test 1a84863d7a2204e0d42f2e1606577c5e92e4473fa37ea0f5bdf829e4bf8e
 F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
 F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
 F test/shell1.test 291c5c4b313adbe44d847af78b730a3bbfa1598c450e09ffe5601170bf7f28e7
-F test/shell2.test 4872069935ca1bf28e86db1b4ed67a4eec04f47a64cf0ab009cce495531a0c61
+F test/shell2.test 09a202f57e7cd99788537f763e0845796a173fcea06a0d199a08d69446fe1daf
 F test/shell3.test 91febeac0412812bf6370abb8ed72700e32bf8f9878849414518f662dfd55e8a
 F test/shell4.test 9abd0c12a7e20a4c49e84d5be208d2124fa6c09e728f56f1f4bee0f02853935f
 F test/shell5.test c8b6c54f26ec537f8558273d7ed293ca3725ef42e6b12b8f151718628bd1473b
@@ -2068,8 +2068,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 2b542326aa8e7e1f6ed9d999b95ae5340278e0821277a17de3cc803b4af793ae
-R 0ed38ff7ea7fb205f7e4da32e3af900c
-U drh
-Z 0df555fd9f7abbe7218483f231da4a15
+P 6bee0a19e2efb6e39097fb22602556791d3d3962c50a1a0471c39a0c61db632e
+R cedc5713e8adb684ab4577dbf72daabf
+U larrybr
+Z 10156d687667290729862638bd5abda0
 # Remove this line to create a well-formed Fossil manifest.
index 0145f4bc06a0dae3b1f126b5117e392d242088f4..26639eef12bd7ae4fcb613aae10d016c6878d781 100644 (file)
@@ -1 +1 @@
-6bee0a19e2efb6e39097fb22602556791d3d3962c50a1a0471c39a0c61db632e
\ No newline at end of file
+aac8ac631de5c5b439c48c13f5fd271d76c11b1a5fd0919dfe4506ef7725f5ab
\ No newline at end of file
index 8e37bac18681db05f6e3eb46417d8fe71a7a2cd8..3fcd3e4a599339291b7eec5e1762c0f35fdcf1c1 100644 (file)
@@ -5834,8 +5834,8 @@ static void import_append_char(ImportCtx *p, int c){
 */
 static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
   int c;
-  int cSep = p->cColSep;
-  int rSep = p->cRowSep;
+  int cSep = (u8)p->cColSep;
+  int rSep = (u8)p->cRowSep;
   p->n = 0;
   c = fgetc(p->in);
   if( c==EOF || seenInterrupt ){
@@ -5924,8 +5924,8 @@ static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
 */
 static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
   int c;
-  int cSep = p->cColSep;
-  int rSep = p->cRowSep;
+  int cSep = (u8)p->cColSep;
+  int rSep = (u8)p->cRowSep;
   p->n = 0;
   c = fgetc(p->in);
   if( c==EOF || seenInterrupt ){
@@ -8806,8 +8806,8 @@ static int do_meta_command(char *zLine, ShellState *p){
                            " for import\n");
         goto meta_command_exit;
       }
-      sCtx.cColSep = p->colSeparator[0];
-      sCtx.cRowSep = p->rowSeparator[0];
+      sCtx.cColSep = (u8)p->colSeparator[0];
+      sCtx.cRowSep = (u8)p->rowSeparator[0];
     }
     sCtx.zFile = zFile;
     sCtx.nLine = 1;
index e50a35d12b02ae9cb1169a61d0bc91831180d7c2..3fad4bd665613d23cebdc48fea9d61376ae6f09d 100644 (file)
@@ -247,4 +247,20 @@ do_test shell2-1.4.10 {
 1
 2}}
 
+# Bug discovered while messing around, .import hangs with
+# bit 7 set in column separator.
+do_test shell2-1.4.11 {
+  forcedelete dummy.csv
+  set df [open dummy.csv w]
+  puts $df dog,cat
+  close $df
+  set res [catchcmd :memory: [string trim {
+ CREATE TABLE t(line text);
+.mode ascii
+.separator "\377" "\n"
+.import dummy.csv t
+ SELECT count(*) FROM t;}]]
+} {0 1}
+
+
 finish_test