Changeset: e24594f676af for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e24594f676af Added Files: sql/test/BugTracker-2018/Tests/sqlitelogictest-coalesce-division-by-zero.Bug-6556.sql sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-extra-columns.Bug-6555.sql sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-extra-columns.Bug-6555.stable.err sql/test/BugTracker-2018/Tests/sqlitelogictest-complex-case-extra-columns.Bug-6555.stable.out sql/test/BugTracker-2018/Tests/sqlitelogictest-nested-case.Bug-6554.sql sql/test/BugTracker-2018/Tests/sqlitelogictest-nested-case.Bug-6554.stable.err sql/test/BugTracker-2018/Tests/sqlitelogictest-nested-case.Bug-6554.stable.out Modified Files: geom/monetdb5/Makefile.ag monetdb5/extras/mal_optimizer_template/Makefile.ag monetdb5/extras/rapi/Makefile.ag monetdb5/mal/mal_builder.c monetdb5/mal/mal_linker.c monetdb5/modules/mal/manifold.c monetdb5/optimizer/opt_mergetable.c monetdb5/optimizer/opt_pipes.c monetdb5/optimizer/opt_projectionpath.c monetdb5/optimizer/opt_pushselect.c monetdb5/optimizer/opt_wlc.c monetdb5/scheduler/run_adder.c sql/backends/monet5/LSST/Makefile.ag sql/backends/monet5/Makefile.ag sql/backends/monet5/UDF/capi/Makefile.ag sql/backends/monet5/UDF/pyapi/Makefile.ag sql/backends/monet5/UDF/pyapi3/Makefile.ag sql/backends/monet5/UDF/udf/Makefile.ag sql/backends/monet5/generator/Makefile.ag sql/backends/monet5/sql_gencode.c sql/backends/monet5/vaults/Makefile.ag sql/backends/monet5/vaults/bam/Makefile.ag sql/backends/monet5/vaults/fits/Makefile.ag sql/backends/monet5/vaults/lidar/Makefile.ag sql/backends/monet5/vaults/netcdf/Makefile.ag sql/backends/monet5/vaults/shp/Makefile.ag sql/include/sql_relation.h sql/server/rel_select.c sql/test/BugTracker-2018/Tests/All sql/test/BugTracker-2018/Tests/truncate_sys_tables.Bug-6543.stable.err sql/test/BugTracker-2018/Tests/truncate_sys_tables.Bug-6543.stable.out Branch: default Log Message:
Merge with Mar2018 branch. diffs (truncated from 2320 to 300 lines): diff --git a/geom/monetdb5/Makefile.ag b/geom/monetdb5/Makefile.ag --- a/geom/monetdb5/Makefile.ag +++ b/geom/monetdb5/Makefile.ag @@ -17,9 +17,9 @@ lib__geom = { DIR = libdir/monetdb5 SOURCES = geom.h geom.c geomBulk.c geom_upgrade.c LIBS = ../lib/libgeom \ - ../../gdk/libbat \ - ../../common/stream/libstream \ - ../../monetdb5/tools/libmonetdb5 \ + NATIVE_WIN32?../../gdk/libbat \ + NATIVE_WIN32?../../common/stream/libstream \ + NATIVE_WIN32?../../monetdb5/tools/libmonetdb5 \ $(GEOS_LIBS) $(PROJ_LIBS) } diff --git a/monetdb5/extras/mal_optimizer_template/Makefile.ag b/monetdb5/extras/mal_optimizer_template/Makefile.ag --- a/monetdb5/extras/mal_optimizer_template/Makefile.ag +++ b/monetdb5/extras/mal_optimizer_template/Makefile.ag @@ -18,9 +18,9 @@ lib_opt_sql_append = { DIR = libdir/monetdb5 SEP = _ SOURCES = opt_sql_append.c opt_sql_append.h - LIBS = ../../tools/libmonetdb5 \ - ../../../gdk/libbat \ - ../../../common/stream/libstream \ + LIBS = NATIVE_WIN32?../../tools/libmonetdb5 \ + NATIVE_WIN32?../../../gdk/libbat \ + NATIVE_WIN32?../../../common/stream/libstream \ $(MALLOC_LIBS) } diff --git a/monetdb5/extras/rapi/Makefile.ag b/monetdb5/extras/rapi/Makefile.ag --- a/monetdb5/extras/rapi/Makefile.ag +++ b/monetdb5/extras/rapi/Makefile.ag @@ -29,9 +29,9 @@ lib__rapi = { DIR = libdir/monetdb5 SOURCES = rapi.c rapi.h converters.c.h XDEPS = $(libr_LIBDEP) - LIBS = ../../tools/libmonetdb5 \ - ../../../gdk/libbat \ - $(MALLOC_LIBS) $(libr_LIBS) + LIBS = NATIVE_WIN32?../../tools/libmonetdb5 \ + NATIVE_WIN32?../../../gdk/libbat \ + $(MALLOC_LIBS) $(libr_LIBS) } headers_rapi_mal = { diff --git a/monetdb5/mal/mal_builder.c b/monetdb5/mal/mal_builder.c --- a/monetdb5/mal/mal_builder.c +++ b/monetdb5/mal/mal_builder.c @@ -172,7 +172,6 @@ newExitStmt(MalBlkPtr mb, str nme) } } else getArg(q,0) = i; - pushInstruction(mb, q); return q; } diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c --- a/monetdb5/mal/mal_linker.c +++ b/monetdb5/mal/mal_linker.c @@ -34,6 +34,10 @@ #define MAXMODULES 128 +#ifndef RTLD_DEEPBIND +#define RTLD_DEEPBIND 0 +#endif + typedef struct{ str modname; str fullname; @@ -103,7 +107,7 @@ getAddress(str fcnname) * * the first argument must be the same as the base name of the * library that is created in src/tools */ - dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL); + dl = mdlopen("libmonetdb5", RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND); if (dl == NULL) return NULL; @@ -143,7 +147,7 @@ getAddress(str fcnname) str loadLibrary(str filename, int flag) { - int mode = RTLD_NOW | RTLD_GLOBAL; + int mode = RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND; char nme[FILENAME_MAX]; void *handle = NULL; str s; diff --git a/monetdb5/modules/mal/manifold.c b/monetdb5/modules/mal/manifold.c --- a/monetdb5/modules/mal/manifold.c +++ b/monetdb5/modules/mal/manifold.c @@ -340,6 +340,10 @@ MANIFOLDevaluate(Client cntxt, MalBlkPtr mat[0].last = (void *) Tloc(mat[0].b, BUNlast(mat[0].b)); mut.pci = copyInstruction(pci); + if ( mut.pci == NULL){ + msg= createException(MAL,"mal.manifold", SQLSTATE(HY001) MAL_MALLOC_FAIL); + goto wrapup; + } mut.pci->fcn = fcn; msg = MANIFOLDjob(&mut); freeInstruction(mut.pci); diff --git a/monetdb5/optimizer/opt_mergetable.c b/monetdb5/optimizer/opt_mergetable.c --- a/monetdb5/optimizer/opt_mergetable.c +++ b/monetdb5/optimizer/opt_mergetable.c @@ -89,7 +89,7 @@ nr_of_bats(MalBlkPtr mb, InstrPtr p) /* some mat's have intermediates (with intermediate result variables), therefor * we pass the old output mat variable */ -inline static void +inline static int mat_add_var(matlist_t *ml, InstrPtr q, InstrPtr p, int var, mat_type_t type, int inputmat, int parentmat, int pushed) { mat_t *dst = &ml->v[ml->top]; @@ -97,7 +97,7 @@ mat_add_var(matlist_t *ml, InstrPtr q, I int s = ml->size * 2; mat_t *v = (mat_t*)GDKzalloc(s * sizeof(mat_t)); if (!v) - return; /* FIXME: error checking */ + return -1; memcpy(v, ml->v, ml->top * sizeof(mat_t)); GDKfree(ml->v); ml->size = s; @@ -119,14 +119,15 @@ mat_add_var(matlist_t *ml, InstrPtr q, I ml->vars[var] = ml->top; } ++ml->top; + return 0; } -inline static void +inline static int mat_add(matlist_t *ml, InstrPtr q, mat_type_t type, const char *func) { - mat_add_var(ml, q, NULL, getArg(q,0), type, -1, -1, 0); (void)func; //printf (" ml.top %d %s\n", ml.top, func); + return mat_add_var(ml, q, NULL, getArg(q,0), type, -1, -1, 0); } static void @@ -172,67 +173,85 @@ mat_pack(MalBlkPtr mb, matlist_t *ml, in pushInstruction(mb, r); } -static void +static int checksize(matlist_t *ml, int v) { if (v >= ml->vsize) { - int sz = ml->vsize, i; + int sz = ml->vsize, i, nvsize, *nhorigin, *ntorigin, *nvars; - ml->vsize *= 2; - ml->horigin = (int*) GDKrealloc(ml->horigin, sizeof(int)* ml->vsize); - ml->torigin = (int*) GDKrealloc(ml->torigin, sizeof(int)* ml->vsize); - ml->vars = (int*) GDKrealloc(ml->vars, sizeof(int)* ml->vsize); + nvsize = ml->vsize * 2; + nhorigin = (int*) GDKrealloc(ml->horigin, sizeof(int)* nvsize); + ntorigin = (int*) GDKrealloc(ml->torigin, sizeof(int)* nvsize); + nvars = (int*) GDKrealloc(ml->vars, sizeof(int)* nvsize); + if(!nhorigin || !ntorigin || !nvars) { + if(nhorigin) + GDKfree(nhorigin); + if(ntorigin) + GDKfree(ntorigin); + if(nvars) + GDKfree(nvars); + return -1; + } + ml->vsize = nvsize; + ml->horigin = nhorigin; + ml->torigin = ntorigin; + ml->vars = nvars; + for (i = sz; i < ml->vsize; i++) { ml->horigin[i] = ml->torigin[i] = -1; ml->vars[i] = -1; } } + return 0; } -static void +static int setPartnr(matlist_t *ml, int ivar, int ovar, int pnr) { int tpnr = -1; - checksize(ml, ivar); - checksize(ml, ovar); + if(checksize(ml, ivar) || checksize(ml, ovar)) + return -1; if (ivar >= 0) tpnr = ml->torigin[ivar]; if (tpnr >= 0) ml->torigin[ovar] = tpnr; ml->horigin[ovar] = pnr; //printf("%d %d ", pnr, tpnr); + return 0; } -static void +static int propagatePartnr(matlist_t *ml, int ivar, int ovar, int pnr) { /* prop head ids to tail */ int tpnr = -1; - checksize(ml, ivar); - checksize(ml, ovar); + if(checksize(ml, ivar) || checksize(ml, ovar)) + return -1; if (ivar >= 0) tpnr = ml->horigin[ivar]; if (tpnr >= 0) ml->torigin[ovar] = tpnr; ml->horigin[ovar] = pnr; //printf("%d %d ", pnr, tpnr); + return 0; } -static void +static int propagateMirror(matlist_t *ml, int ivar, int ovar) { /* prop head ids to head and tail */ int tpnr; - checksize(ml, ivar); - checksize(ml, ovar); - tpnr = ml->horigin[ivar]; + if(checksize(ml, ivar) || checksize(ml, ovar)) + return -1; + tpnr = ml->horigin[ivar]; if (tpnr >= 0) { ml->horigin[ovar] = tpnr; ml->torigin[ovar] = tpnr; - } + } + return 0; } static int @@ -254,17 +273,19 @@ overlap(matlist_t *ml, int lv, int rv, i return lpnr == rpnr; } -static void +static int mat_set_prop(matlist_t *ml, MalBlkPtr mb, InstrPtr p) { int k, tpe = getArgType(mb, p, 0); tpe = getBatType(tpe); for(k=1; k < p->argc; k++) { - setPartnr(ml, -1, getArg(p,k), k); - if (tpe == TYPE_oid) - propagateMirror(ml, getArg(p,k), getArg(p,k)); + if(setPartnr(ml, -1, getArg(p,k), k)) + return -1; + if (tpe == TYPE_oid && propagateMirror(ml, getArg(p,k), getArg(p,k))) + return -1; } + return 0; } static InstrPtr @@ -276,7 +297,8 @@ mat_delta(matlist_t *ml, MalBlkPtr mb, I //printf("# %s.%s(%d,%d,%d,%d)", getModuleId(p), getFunctionId(p), m, n, o, e); - r = newInstruction(mb, matRef,packRef); + if((r = newInstruction(mb, matRef,packRef)) == NULL) + return NULL; getArg(r, 0) = getArg(p,0); tpe = getArgType(mb,p,0); @@ -287,6 +309,8 @@ mat_delta(matlist_t *ml, MalBlkPtr mb, I for(j=1; j < mat[m].mi->argc; j++) { if (overlap(ml, getArg(mat[e].mi, k), getArg(mat[m].mi, j), k, j, 0)){ InstrPtr q = copyInstruction(p); + if(!q) + return NULL; /* remove last argument */ if (k < mat[m].mi->argc-1) @@ -294,8 +318,8 @@ mat_delta(matlist_t *ml, MalBlkPtr mb, I /* make sure to resolve again */ q->token = ASSIGNsymbol; q->typechk = TYPE_UNKNOWN; - q->fcn = NULL; - q->blk = NULL; + q->fcn = NULL; + q->blk = NULL; getArg(q, 0) = newTmpVariable(mb, tpe); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list