ArielGlenn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/54330


Change subject: bug fix, handle partial buffers that don't start with open 
parenthesis
......................................................................

bug fix, handle partial buffers that don't start with open parenthesis

account for case where input buffer ends with closing paren of tuple
and next buffer read will get possible spaces and the separator (comma)

Change-Id: I2d2ca426e1c12f78812c7eccbc09f43294726b2b
---
M xmlfileutils/sql2txt.c
1 file changed, 14 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/dumps 
refs/changes/30/54330/1

diff --git a/xmlfileutils/sql2txt.c b/xmlfileutils/sql2txt.c
index 3d64a82..efb9ded 100644
--- a/xmlfileutils/sql2txt.c
+++ b/xmlfileutils/sql2txt.c
@@ -225,8 +225,20 @@
     if (!start) skip++;
     else start+=7;
   }
-  else if (sql->in_buf->content[0] != '(') skip++;
-  else start = sql->in_buf->content;
+  else {
+    start = sql->in_buf->content;
+    /*
+       allow leading blanks, a separator, trailing blanks, because we
+       may be reading from the end of a previous tuple in the middle of a line
+       this means someone could sneak in an extra separator or even start a
+       line with one, stricly speaking that's garbage syntax, but let 'em
+       do it as long as the tuples are good, who cares
+       */
+    while (*start == ' ') start++;
+    if (*start == ',') start++;
+    while (*start == ' ') start++;
+    if (*start != '(') skip++;
+  }
 
   if (skip) return(0); /* don't process this line, it doesn't have a data 
tuple */
   buf[0] = '\n';

-- 
To view, visit https://gerrit.wikimedia.org/r/54330
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d2ca426e1c12f78812c7eccbc09f43294726b2b
Gerrit-PatchSet: 1
Gerrit-Project: operations/dumps
Gerrit-Branch: ariel
Gerrit-Owner: ArielGlenn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to