Changeset: ed8fe60e504d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ed8fe60e504d Added Files: sql/test/json/Tests/jsontext.Bug-6859.stable.err sql/test/json/Tests/jsontext.Bug-6859.stable.out Modified Files: NT/mkodbcwxs.py NT/mksqlwxs.py misc/python/fixlicense.py monetdb5/mal/mal.h monetdb5/modules/atoms/json.c monetdb5/modules/mal/tracer.c monetdb5/modules/mal/tracer.h sql/backends/monet5/UDF/pyapi3/pytypes.h sql/backends/monet5/sql_session.mal sql/backends/monet5/vaults/fits/72_fits.sql sql/common/sql_types.c sql/server/rel_distribute.c sql/storage/store.c sql/test/SQLancer/Tests/sqlancer03.sql sql/test/SQLancer/Tests/sqlancer03.stable.out testing/exportutils.py testing/malcheck.py Branch: oscar Log Message:
Merge with Jun2020 branch. diffs (truncated from 441 to 300 lines): diff --git a/NT/mkodbcwxs.py b/NT/mkodbcwxs.py --- a/NT/mkodbcwxs.py +++ b/NT/mkodbcwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mkodbcwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB-ODBC-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB-ODBC-Installer.wixobj diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + # python mksqlwxs.py VERSION makedefs.txt PREFIX > PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe" -nologo -arch x64/x86 PREFIX/MonetDB5-SQL-Installer.wxs # "c:\Program Files (x86)\WiX Toolset v3.10\bin\light.exe" -nologo -sice:ICE03 -sice:ICE60 -sice:ICE82 -ext WixUIExtension PREFIX/MonetDB5-SQL-Installer.wixobj diff --git a/misc/python/fixlicense.py b/misc/python/fixlicense.py --- a/misc/python/fixlicense.py +++ b/misc/python/fixlicense.py @@ -177,7 +177,11 @@ def addlicense(file, pre = None, post = except IOError: print('Cannot create temp file %s.new' % file, file=sys.stderr) return - data = f.read() + try: + data = f.read() + except UnicodeError: + print('UnicodeError in file %s' % file, file=sys.stderr) + return if PERL_COPYRIGHT in data: notice = PERL_COPYRIGHT elif COPYRIGHT_NOTICE in data: @@ -282,7 +286,11 @@ def dellicense(file, pre = None, post = except IOError: print('Cannot create temp file %s.new' % file, file=sys.stderr) return - data = f.read() + try: + data = f.read() + except UnicodeError: + print('UnicodeError in file %s' % file, file=sys.stderr) + return if PERL_COPYRIGHT in data: notice = PERL_COPYRIGHT elif COPYRIGHT_NOTICE in data: diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h --- a/monetdb5/mal/mal.h +++ b/monetdb5/mal/mal.h @@ -98,7 +98,7 @@ mal_export void mal_reset(void); #define LIST_MAL_FLOW 128 /* output MAL dataflow dependencies */ #define LIST_MAL_CALL (LIST_MAL_NAME | LIST_MAL_VALUE ) #define LIST_MAL_DEBUG (LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS | LIST_MAL_FLOW) -#define LIST_MAL_ALL (LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_PROPS | LIST_MAL_MAPI) +#define LIST_MAL_ALL (LIST_MAL_NAME | LIST_MAL_VALUE | LIST_MAL_TYPE | LIST_MAL_MAPI) /* type check status is kept around to improve type checking efficiency */ #define TYPE_ERROR -1 diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1178,73 +1178,92 @@ JSONfilter(json *ret, json *js, str *exp // The json string should be valid static char * -JSONplaintext(char *r, size_t *l, JSON *jt, int idx, char sep) +JSONplaintext(char **r, size_t *l, size_t *ilen, JSON *jt, int idx, str sep, size_t sep_len) { int i; - size_t j; + unsigned int j, k; switch (jt->elm[idx].kind) { case JSON_OBJECT: for (i = jt->elm[idx].next; i; i = jt->elm[i].next) if (jt->elm[i].child) - r = JSONplaintext(r, l, jt, jt->elm[i].child, sep); + *r = JSONplaintext(r, l, ilen, jt, jt->elm[i].child, sep, sep_len); break; case JSON_ARRAY: for (i = jt->elm[idx].next; i; i = jt->elm[i].next) - r = JSONplaintext(r, l, jt, i, sep); + *r = JSONplaintext(r, l, ilen, jt, i, sep, sep_len); break; case JSON_ELEMENT: case JSON_VALUE: if (jt->elm[idx].child) - r = JSONplaintext(r, l, jt, jt->elm[idx].child, sep); + *r = JSONplaintext(r, l, ilen, jt, jt->elm[idx].child, sep, sep_len); break; - case JSON_STRING: - for (j = 1; *l > 1 && j < jt->elm[idx].valuelen - 1; j++) { + case JSON_STRING: + // Make sure there is enough space for the value plus the separator plus the NULL byte + if (*l < jt->elm[idx].valuelen - 2 + sep_len + 1) { + char *p = *r - *ilen + *l; + *ilen *= 2; + *r = GDKrealloc(p, *ilen); + *r += *l; + *l = *ilen - *l; + } + for (j = 1; j < jt->elm[idx].valuelen - 1; j++) { if (jt->elm[idx].value[j] == '\\') - *r = jt->elm[idx].value[++j]; + **r = jt->elm[idx].value[++j]; else - *r = jt->elm[idx].value[j]; - r++; - (*l)--; - } - if (*l > 1 && sep) { - *r++ = sep; + **r = jt->elm[idx].value[j]; + (*r)++; (*l)--; } + for(k = 0; k < sep_len; k++) { + **r = *(sep + k); + (*r)++; + } + (*l) -= k; break; default: - for (j = 0; *l > 1 && j < jt->elm[idx].valuelen; j++) { - *r = jt->elm[idx].value[j]; - r++; + if (*l < jt->elm[idx].valuelen + sep_len + 1) { + unsigned int offset = *ilen - *l; + char *p = *r - offset; + *ilen *= 2; + *r = GDKrealloc(p, *ilen); + *r += offset; + *l = *ilen - offset; + } + for (j = 0; j < jt->elm[idx].valuelen; j++) { + **r = jt->elm[idx].value[j]; + (*r)++; (*l)--; } - if (*l > 1 && sep) { - *r++ = sep; - (*l)--; + for(k = 0; k < sep_len; k++) { + **r = *(sep + k); + (*r)++; } + (*l) -= k; } assert(*l > 0); - *r = 0; - return r; + **r = 0; + return *r; } static str JSONjson2text(str *ret, json *js) { JSON *jt; - size_t l; + size_t l, ilen; str s; jt = JSONparse(*js); CHECK_JSON(jt); - l = strlen(*js) + 1; + ilen = l = strlen(*js) + 1; s = GDKmalloc(l); if(s == NULL) { JSONfree(jt); throw(MAL,"json2txt", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - JSONplaintext(s, &l, jt, 0, ' '); + s = JSONplaintext(&s, &l, &ilen, jt, 0, " ", 1); + s -= ilen - l; l = strlen(s); if (l) s[l - 1] = 0; @@ -1257,22 +1276,23 @@ static str JSONjson2textSeparator(str *ret, json *js, str *sep) { JSON *jt; - size_t l; + size_t l, ilen, sep_len = strlen(*sep); str s; jt = JSONparse(*js); CHECK_JSON(jt); - l = strlen(*js) + 1; + ilen = l = strlen(*js) + 1; s = GDKmalloc(l); if(s == NULL) { JSONfree(jt); throw(MAL,"json2txt", SQLSTATE(HY013) MAL_MALLOC_FAIL); } - JSONplaintext(s, &l, jt, 0, **sep); + s = JSONplaintext(&s, &l, &ilen, jt, 0, *sep, sep_len); + s -= ilen - l; l = strlen(s); - if (l && **sep) - s[l - 1] = 0; + if (l && sep_len) + s[l - sep_len] = 0; *ret = s; JSONfree(jt); return MAL_SUCCEED; diff --git a/monetdb5/modules/mal/tracer.c b/monetdb5/modules/mal/tracer.c --- a/monetdb5/modules/mal/tracer.c +++ b/monetdb5/modules/mal/tracer.c @@ -4,8 +4,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - * - * + */ + +/* * GDKtracer exposes routines where an occuring failure should reach the * client immediately. For that reason, GDKtracer reports those errors * directly to the stream. diff --git a/monetdb5/modules/mal/tracer.h b/monetdb5/modules/mal/tracer.h --- a/monetdb5/modules/mal/tracer.h +++ b/monetdb5/modules/mal/tracer.h @@ -4,9 +4,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. - * + */ + +/* * All the functions correspond one by one to the API calls in gdk_tracer.h - * */ #ifndef _TRACER_H diff --git a/sql/backends/monet5/UDF/pyapi3/pytypes.h b/sql/backends/monet5/UDF/pyapi3/pytypes.h --- a/sql/backends/monet5/UDF/pyapi3/pytypes.h +++ b/sql/backends/monet5/UDF/pyapi3/pytypes.h @@ -1,4 +1,4 @@ - /* +/* * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/sql/backends/monet5/sql_session.mal b/sql/backends/monet5/sql_session.mal --- a/sql/backends/monet5/sql_session.mal +++ b/sql/backends/monet5/sql_session.mal @@ -1,3 +1,9 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. + module sql; unsafe pattern sql.setquerytimeout(n:int):void diff --git a/sql/backends/monet5/vaults/fits/72_fits.sql b/sql/backends/monet5/vaults/fits/72_fits.sql --- a/sql/backends/monet5/vaults/fits/72_fits.sql +++ b/sql/backends/monet5/vaults/fits/72_fits.sql @@ -1,3 +1,8 @@ +-- This Source Code Form is subject to the terms of the Mozilla Public +-- License, v. 2.0. If a copy of the MPL was not distributed with this +-- file, You can obtain one at http://mozilla.org/MPL/2.0/. +-- +-- Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. create procedure listdir(dirname string) external name fits.listdir; diff --git a/sql/common/sql_types.c b/sql/common/sql_types.c --- a/sql/common/sql_types.c +++ b/sql/common/sql_types.c @@ -604,7 +604,7 @@ sql_dup_subfunc(sql_allocator *sa, sql_f sql_arg *s = m->data; if (s->type.type->eclass == EC_ANY) { - if (!st) + if (!st || st->type->eclass == EC_ANY) /* if input parameter is ANY, skip validation */ st = tn->data; else if (subtype_cmp(st, tn->data)) return NULL; diff --git a/sql/server/rel_distribute.c b/sql/server/rel_distribute.c --- a/sql/server/rel_distribute.c +++ b/sql/server/rel_distribute.c @@ -6,7 +6,6 @@ * Copyright 1997 - July 2008 CWI, August 2008 - 2020 MonetDB B.V. */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list