Changeset: fb271a0b79db for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb271a0b79db
Modified Files:
        clients/Tests/MAL-signatures_all.stable.out
        clients/Tests/MAL-signatures_fits_geom.stable.out
        clients/Tests/MAL-signatures_geom.stable.out
        clients/Tests/MAL-signatures_none.stable.out
        clients/mapiclient/tomograph.c
        common/utils/muuid.c
        gdk/gdk_bbp.c
        gdk/gdk_heap.c
        gdk/gdk_imprints.c
        gdk/gdk_posix.c
        gdk/gdk_sample.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_debugger.c
        monetdb5/mal/mal_function.c
        monetdb5/mal/mal_listing.c
        monetdb5/mal/mal_profiler.c
        monetdb5/mal/mal_resolve.c
        monetdb5/modules/atoms/Makefile.ag
        monetdb5/modules/atoms/json.c
        monetdb5/modules/atoms/json.mal
        monetdb5/modules/atoms/str.c
        monetdb5/modules/atoms/uuid.c
        monetdb5/modules/kernel/microbenchmark.c
        monetdb5/modules/kernel/mmath.c
        monetdb5/modules/mal/Makefile.ag
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/remote.c
        monetdb5/optimizer/opt_mapreduce.c
        monetdb5/optimizer/opt_multiplex.c
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_gencode.c
        sql/benchmarks/tpch/Tests/02-explain.stable.out
        sql/benchmarks/tpch/Tests/02-plan.stable.out
        sql/benchmarks/tpch/Tests/10-plan.stable.out
        sql/benchmarks/tpch/Tests/17-explain.stable.out
        sql/benchmarks/tpch/Tests/17-plan.stable.out
        sql/benchmarks/tpch/Tests/18-plan.stable.out
        sql/benchmarks/tpch/Tests/20-explain.stable.out
        sql/benchmarks/tpch/Tests/20-plan.stable.out
        sql/benchmarks/tpch/Tests/21-plan.stable.out
        sql/include/sql_catalog.h
        sql/server/rel_dump.c
        sql/server/rel_exp.c
        sql/server/rel_exp.h
        sql/server/rel_optimizer.c
        sql/server/rel_select.c
        tools/merovingian/daemon/connections.c
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/daemon/discoveryrunner.c
        tools/merovingian/utils/Makefile.ag
        tools/merovingian/utils/utils.c
Branch: geo
Log Message:

Merge with default branch.


diffs (truncated from 4384 to 300 lines):

diff --git a/clients/Tests/MAL-signatures_all.stable.out 
b/clients/Tests/MAL-signatures_all.stable.out
--- a/clients/Tests/MAL-signatures_all.stable.out
+++ b/clients/Tests/MAL-signatures_all.stable.out
@@ -39340,7 +39340,7 @@ comment Create an iterator with fixed gr
 
 command json.dump(j:json):void 
 address JSONdump;
-pattern json.fold(k:bat[:oid,:any]):json 
+pattern json.fold(v:bat[:oid,:any]):json 
 address JSONfold;
 comment Combine the value list into a single json array object.
 
diff --git a/clients/Tests/MAL-signatures_fits_geom.stable.out 
b/clients/Tests/MAL-signatures_fits_geom.stable.out
--- a/clients/Tests/MAL-signatures_fits_geom.stable.out
+++ b/clients/Tests/MAL-signatures_fits_geom.stable.out
@@ -39256,7 +39256,7 @@ comment Create an iterator with fixed gr
 
 command json.dump(j:json):void 
 address JSONdump;
-pattern json.fold(k:bat[:oid,:any]):json 
+pattern json.fold(v:bat[:oid,:any]):json 
 address JSONfold;
 comment Combine the value list into a single json array object.
 
diff --git a/clients/Tests/MAL-signatures_geom.stable.out 
b/clients/Tests/MAL-signatures_geom.stable.out
--- a/clients/Tests/MAL-signatures_geom.stable.out
+++ b/clients/Tests/MAL-signatures_geom.stable.out
@@ -39232,7 +39232,7 @@ comment Create an iterator with fixed gr
 
 command json.dump(j:json):void 
 address JSONdump;
-pattern json.fold(k:bat[:oid,:any]):json 
+pattern json.fold(v:bat[:oid,:any]):json 
 address JSONfold;
 comment Combine the value list into a single json array object.
 
diff --git a/clients/Tests/MAL-signatures_none.stable.out 
b/clients/Tests/MAL-signatures_none.stable.out
--- a/clients/Tests/MAL-signatures_none.stable.out
+++ b/clients/Tests/MAL-signatures_none.stable.out
@@ -39061,7 +39061,7 @@ comment Create an iterator with fixed gr
 
 command json.dump(j:json):void 
 address JSONdump;
-pattern json.fold(k:bat[:oid,:any]):json 
+pattern json.fold(v:bat[:oid,:any]):json 
 address JSONfold;
 comment Combine the value list into a single json array object.
 
diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c
--- a/clients/mapiclient/tomograph.c
+++ b/clients/mapiclient/tomograph.c
@@ -820,7 +820,7 @@ initcolors(FILE *map)
 
        if (map) {
                /* read the color map */
-               while (fscanf(map,"%s\t%s\t%s\n", buf[0],buf[1],buf[2])== 3 && 
i< NUM_COLORS) {
+               while (fscanf(map,"%127s\t%127s\t%127s\n", 
buf[0],buf[1],buf[2])== 3 && i< NUM_COLORS) {
                        colors[i].mod = strdup(buf[0]);
                        colors[i].fcn = strdup(buf[1]);
                        colors[i].freq = 0;
@@ -1875,7 +1875,7 @@ parser(char *row)
                /* convert time to epoch in seconds*/
                memset(&stm, 0, sizeof(struct tm));
                c = strptime(c + 1, "%H:%M:%S", &stm);
-               clkticks = (((lng) (stm.tm_hour * 60) + stm.tm_min) * 60 + 
stm.tm_sec) * 1000000;
+               clkticks = (((lng) stm.tm_hour * 60 + stm.tm_min) * 60 + 
stm.tm_sec) * 1000000;
                if (c == 0)
                        return -11;
                if (*c == '.') {
@@ -1914,11 +1914,11 @@ parser(char *row)
        numa = c+1;
        for(c++; *c && *c !='"'; c++)
                ;
-       if (*c == '"'){
-               *c = 0;
-               numa= strdup(numa);
-               *c = '"';
-       }
+       if (*c == 0)
+               return -1;
+       *c = 0;
+       numa= strdup(numa);
+       *c = '"';
        c = strchr(c + 1, ',');
 
 #ifdef FOOTPRINT
@@ -1932,16 +1932,22 @@ parser(char *row)
 
        reads = strtoll(c + 1, NULL, 10);
        c = strchr(c + 1, ',');
-       if (c == 0)
+       if (c == 0) {
+               free(numa);
                return -8;
+       }
        writes = strtoll(c + 1, NULL, 10);
 
        /* check basic validity */
-       if ((cc= strrchr(row,']')) == 0 || *(cc+1) !=0)
+       if ((cc= strrchr(row,']')) == 0 || *(cc+1) !=0) {
+               free(numa);
                return -1;
+       }
        c = strchr(c + 1, ',');
-       if (c == 0)
+       if (c == 0) {
+               free(numa);
                return -9;
+       }
        c++;
        fcn = c;
        stmt = strdup(fcn);
@@ -1954,6 +1960,7 @@ parser(char *row)
                        fcn++;
                if (strchr(fcn, '.') == 0) {
                        free(stmt);
+                       free(numa);
                        return -10;
                }
        } else {
@@ -1972,6 +1979,7 @@ parser(char *row)
 wrapup:
 #endif
        update(state, thread, clkticks, ticks, memory, numa, footprint, reads, 
writes, fcn, stmt);
+       free(numa);
 #else
        (void) row;
 #endif
diff --git a/common/utils/muuid.c b/common/utils/muuid.c
--- a/common/utils/muuid.c
+++ b/common/utils/muuid.c
@@ -27,6 +27,9 @@
 #ifdef HAVE_UUID_UUID_H
 # include <uuid/uuid.h>
 #endif
+#ifndef HAVE_UUID
+# include <openssl/rand.h>
+#endif
 
 /**
  * Shallow wrapper around uuid, that comes up with some random pseudo
@@ -49,14 +52,27 @@ generateUUID(void)
        /* try to do some pseudo interesting stuff, and stash it in the
         * format of a UUID to at least return some uniform answer */
        char out[37];
+       union {
+               unsigned char randbuf[16];
+               unsigned short s[8];
+       } r;
 
-       /* generate something like this:
-        * cefa7a9c-1dd2-11b2-8350-880020adbeef ("%08x-%04x-%04x-%04x-%012x") */
-       snprintf(out, sizeof(out), "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
-                rand() % 65536, rand() % 65536,
-                rand() % 65536, rand() % 65536,
-                rand() % 65536, rand() % 65536,
-                rand() % 65536, rand() % 65536);
+       if (RAND_bytes(r.randbuf, 16) >= 0) {
+               snprintf(out, sizeof(out),
+                        "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
+                        r.s[0], r.s[1], r.s[2], r.s[3],
+                        r.s[4], r.s[5], r.s[6], r.s[7]);
+       } else {
+               /* generate something like this:
+                * cefa7a9c-1dd2-11b2-8350-880020adbeef
+                * ("%08x-%04x-%04x-%04x-%012x") */
+               snprintf(out, sizeof(out),
+                        "%04x%04x-%04x-%04x-%04x-%04x%04x%04x",
+                        rand() % 65536, rand() % 65536,
+                        rand() % 65536, rand() % 65536,
+                        rand() % 65536, rand() % 65536,
+                        rand() % 65536, rand() % 65536);
+       }
 #endif
        return strdup(out);
 }
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -1023,12 +1023,14 @@ BBPaddfarm(const char *dirname, int role
        if (rolemask == 0 || (rolemask & 1 && BBPfarms[0].dirname != NULL)) {
                GDKfatal("BBPaddfarm: bad rolemask\n");
        }
-       if (stat(dirname, &st) == -1) {
-               if (mkdir(dirname, 0755) < 0) {
+       if (mkdir(dirname, 0755) < 0) {
+               if (errno == EEXIST) {
+                       if (stat(dirname, &st) == -1 || !S_ISDIR(st.st_mode)) {
+                               GDKfatal("BBPaddfarm: %s: not a directory\n", 
dirname);
+                       }
+               } else {
                        GDKfatal("BBPaddfarm: %s: cannot create directory\n", 
dirname);
                }
-       } else if (!S_ISDIR(st.st_mode)) {
-               GDKfatal("BBPaddfarm: %s: not a directory\n", dirname);
        }
        for (i = 0; i < MAXFARMS; i++) {
                if (BBPfarms[i].dirname == NULL) {
@@ -1341,7 +1343,7 @@ BBPdir_subcommit(int cnt, bat *subcommit
 {
        FILE *fp;
        stream *s = NULL;
-       bat i, j = 1;
+       bat j = 1;
        char buf[3000];
        char *p;
        int n;
@@ -1386,7 +1388,6 @@ BBPdir_subcommit(int cnt, bat *subcommit
        if (BBPdir_header(s, n) < 0)
                goto bailout;
        n = 0;
-       i = 1;
        for (;;) {
                /* but for subcommits, all except the bats in the list
                 * retain their existing mode */
@@ -1400,7 +1401,7 @@ BBPdir_subcommit(int cnt, bat *subcommit
                if (j == cnt && n == 0)
                        break;
                if (j < cnt && (n == 0 || subcommit[j] <= n || fp == NULL)) {
-                       i = subcommit[j];
+                       bat i = subcommit[j];
                        /* BBP.dir consists of all persistent bats only */
                        if (BBP_status(i) & BBPPERSISTENT) {
                                if (new_bbpentry(s, i) < 0)
@@ -1414,7 +1415,6 @@ BBPdir_subcommit(int cnt, bat *subcommit
                                j++;
                        while (j < cnt && subcommit[j] == i);
                } else {
-                       i = n;
                        if (mnstr_printf(s, "%s", buf) < 0)
                                goto bailout;
                        IODEBUG mnstr_printf(GDKstdout, "%s", buf);
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -268,7 +268,6 @@ HEAPextend(Heap *h, size_t size, int may
                                        HEAPfree(&bak);
                                        return 0;
                                }
-                               failure = "h->storage == STORE_MEM && can_map 
&& !h->base";
                        }
                        fd = GDKfdlocate(h->farmid, nme, "wb", ext);
                        if (fd >= 0) {
diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -840,7 +840,7 @@ IMPSimprintsize(BAT *b)
 {
        lng sz=0;
        if( b->T->imprints){
-               sz = b->T->imprints->impcnt * sizeof(IMPS_PAGE/8);
+               sz = b->T->imprints->impcnt * b->T->imprints->bits / 8;
                sz += b->T->imprints->dictcnt * sizeof(cchdc_t);
        }
        return sz;
diff --git a/gdk/gdk_posix.c b/gdk/gdk_posix.c
--- a/gdk/gdk_posix.c
+++ b/gdk/gdk_posix.c
@@ -400,7 +400,7 @@ MT_mremap(const char *path, int mode, vo
                        fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): munmap() failed\n", __FILE__, __LINE__, 
path?path:"NULL", PTRFMTCAST old_address, old_size, *new_size);
                        return NULL;
                }
-               if (truncate(path, *new_size) < 0)
+               if (path && truncate(path, *new_size) < 0)
                        fprintf(stderr, "#MT_mremap(%s): truncate failed\n", 
path);
 #ifdef MMAP_DEBUG
                fprintf(stderr, "MT_mremap(%s,"PTRFMT","SZFMT","SZFMT") -> 
shrinking\n", path?path:"NULL", PTRFMTCAST old_address, old_size, *new_size);
@@ -420,12 +420,12 @@ MT_mremap(const char *path, int mode, vo
                /* "normal" memory map */
 
                if ((fd = open(path, O_RDWR)) < 0) {
-                       fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): open() failed\n", __FILE__, __LINE__, 
path?path:"NULL", PTRFMTCAST old_address, old_size, *new_size);
+                       fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): open() failed\n", __FILE__, __LINE__, 
path, PTRFMTCAST old_address, old_size, *new_size);
                        return NULL;
                }
                if (GDKextendf(fd, *new_size, path) < 0) {
                        close(fd);
-                       fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): GDKextendf() failed\n", __FILE__, 
__LINE__, path?path:"NULL", PTRFMTCAST old_address, old_size, *new_size);
+                       fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): GDKextendf() failed\n", __FILE__, 
__LINE__, path, PTRFMTCAST old_address, old_size, *new_size);
                        return NULL;
                }
 #ifdef HAVE_MREMAP
@@ -535,7 +535,7 @@ MT_mremap(const char *path, int mode, vo
                                                  MONETDB_MODE);
                                        free(p);
                                        if (fd < 0) {
-                                               fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): fd < 0\n", __FILE__, __LINE__, 
path?path:"NULL", PTRFMTCAST old_address, old_size, *new_size);
+                                               fprintf(stderr, "= %s:%d: 
MT_mremap(%s,"PTRFMT","SZFMT","SZFMT"): fd < 0\n", __FILE__, __LINE__, path, 
PTRFMTCAST old_address, old_size, *new_size);
                                                return NULL;
                                        }
                                        if (write(fd, old_address,
@@ -563,7 +563,7 @@ MT_mremap(const char *path, int mode, vo
 #else
                                                        "ftruncate()"
 #endif
-                                                       " failed\n", __FILE__, 
__LINE__, path?path:"NULL", PTRFMTCAST old_address, old_size, *new_size);
+                                                       " failed\n", __FILE__, 
__LINE__, path, PTRFMTCAST old_address, old_size, *new_size);
                                                return NULL;
                                        }
                                        p = mmap(NULL, *new_size, prot, flags,
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to