Changeset: 3ca8f0ffca39 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3ca8f0ffca39 Modified Files: clients/src/mapiclient/mclient.mx Branch: default Log Message:
Merge with Jun2010 branch. diffs (124 lines): diff -r b355aba116d3 -r 3ca8f0ffca39 clients/ChangeLog.Jun2010 --- a/clients/ChangeLog.Jun2010 Wed Aug 18 21:36:05 2010 +0200 +++ b/clients/ChangeLog.Jun2010 Thu Aug 19 10:07:20 2010 +0200 @@ -1,9 +1,16 @@ # ChangeLog file for clients # This file is updated with Maddlog +* Thu Aug 19 2010 Sjoerd Mullender <sjo...@acm.org> +- mclient now complains about NULL bytes in the input when in interactive + mode. + * Fri Aug 13 2010 Fabian Groffen <fab...@cwi.nl> -- Slight rendering improvements to mclient's tabular output when rendering results larger than the available screen width, headers were previously unnecessarily squeezed. -- Fix bug #2650, a too small buffer caused the active database as reported by mclient's welcome message to be truncated +- Slight rendering improvements to mclient's tabular output when + rendering results larger than the available screen width, headers + were previously unnecessarily squeezed. +- Fix bug #2650, a too small buffer caused the active database as + reported by mclient's welcome message to be truncated * Wed Jul 21 2010 Fabian Groffen <fab...@cwi.nl> - Add --version option to mclient. diff -r b355aba116d3 -r 3ca8f0ffca39 clients/src/mapiclient/mclient.mx --- a/clients/src/mapiclient/mclient.mx Wed Aug 18 21:36:05 2010 +0200 +++ b/clients/src/mapiclient/mclient.mx Thu Aug 19 10:07:20 2010 +0200 @@ -1801,7 +1801,7 @@ MapiHdl hdl = mapi_get_active(mid); MapiMsg rc = MOK; int sent = 0; /* whether we sent any data to the server */ - int first = 1; /* first line processing */ + int lineno = 1; #ifdef HAVE_LIBREADLINE if (prompt == NULL) @@ -1809,6 +1809,10 @@ oldbuf = buf = malloc(BUFSIZ); do { + if (prompt) { + /* clear errors when interactive */ + errseen = 0; + } mnstr_flush(toConsole); timerPause(); #ifdef HAVE_LIBREADLINE @@ -1837,6 +1841,8 @@ } else #endif { + int c = 0; + #ifndef HAVE_LIBREADLINE if (prompt) { fputs(hdl ? "more>" : prompt, stdout); @@ -1846,11 +1852,35 @@ if (buf != oldbuf) free(buf); buf = oldbuf; - line = fgets(buf, BUFSIZ, fp); - } - if (prompt) { - /* clear errors when interactive */ - errseen = 0; + line = buf; + while (line < buf + BUFSIZ - 1 && + (c = getc(fp)) != EOF) { + if (c == 0) { + fprintf(stderr, "NULL byte in input on line %d of input\n", lineno); + /* read away rest of line */ + while ((c = getc(fp)) != EOF && + c != '\n') + ; + errseen = 1; + c = 0x1234; /* indicate error */ + if (hdl) { + mapi_close_handle(hdl); + hdl = NULL; + } + break; + } + *line++ = c; + if (c == '\n') + break; + } + if (c == 0x1234) + continue; + if (line == buf) + line = NULL; + else { + *line = 0; + line = buf; + } } #ifdef HAVE_ICONV if (line != NULL && encoding != NULL && cd_in != (iconv_t) -1) { @@ -1871,10 +1901,10 @@ #ifdef HAVE_ICONV encoding == NULL && #endif - first && + lineno == 1 && strncmp(line, UTF8BOM, UTF8BOMLENGTH) == 0) line += UTF8BOMLENGTH; /* skip Byte Order Mark (BOM) */ - first = 0; + lineno++; if (line == NULL || (mode == XQUERY && line[0] == '<' && line[1] == '>')) { /* end of file */ diff -r b355aba116d3 -r 3ca8f0ffca39 sql/src/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err --- a/sql/src/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err Wed Aug 18 21:36:05 2010 +0200 +++ b/sql/src/test/BugTracker-2008/Tests/insert-null-byte.SF-2233581.stable.err Thu Aug 19 10:07:20 2010 +0200 @@ -81,7 +81,11 @@ # 17:08:26 > ./insert-null-byte.SF-2233581.SQL.sh insert-null-byte.SF-2233581 # 17:08:26 > -NULL byte in input +NULL byte in input on line 4 of input +MAPI = mone...@koolmees:30299 +QUERY = 3 "some other string" +ERROR = !syntax error, unexpected sqlINT in: "3" + # 17:08:26 > # 17:08:26 > Done. _______________________________________________ Checkin-list mailing list Checkin-list@monetdb.org http://mail.monetdb.org/mailman/listinfo/checkin-list