MonetDB: Dec2016 - Deal with NULL pointer.

2017-04-19 Thread Sjoerd Mullender
Changeset: ba9f3e4de5fc for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ba9f3e4de5fc
Modified Files:
monetdb5/ChangeLog.Dec2016
monetdb5/mal/mal_stack.c
Branch: Dec2016
Log Message:

Deal with NULL pointer.


diffs (27 lines):

diff --git a/monetdb5/ChangeLog.Dec2016 b/monetdb5/ChangeLog.Dec2016
--- a/monetdb5/ChangeLog.Dec2016
+++ b/monetdb5/ChangeLog.Dec2016
@@ -1,3 +1,7 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Wed Apr 19 2017 Sjoerd Mullender 
+- Fixed a bug causing a crash during cleanup when mserver5 is stopped
+  with monetdb stop database.
+
diff --git a/monetdb5/mal/mal_stack.c b/monetdb5/mal/mal_stack.c
--- a/monetdb5/mal/mal_stack.c
+++ b/monetdb5/mal/mal_stack.c
@@ -94,8 +94,10 @@ reallocGlobalStack(MalStkPtr old, int cn
 void
 freeStack(MalStkPtr stk)
 {
-   clearStack(stk);
-   GDKfree(stk);
+   if (stk != NULL) {
+   clearStack(stk);
+   GDKfree(stk);
+   }
 }
 
 void
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Dec2016 - Try to get core dump info when program crashes.

2017-04-19 Thread Sjoerd Mullender
Changeset: 3a85c43261f0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3a85c43261f0
Modified Files:
testing/Mtest.py.in
Branch: Dec2016
Log Message:

Try to get core dump info when program crashes.


diffs (65 lines):

diff --git a/testing/Mtest.py.in b/testing/Mtest.py.in
--- a/testing/Mtest.py.in
+++ b/testing/Mtest.py.in
@@ -55,6 +55,23 @@ else:
 # no coloring if not to a tty
 RED = GREEN = PURPLE = BLACK = ''
 
+if os.path.exists('/usr/bin/coredumpctl'):
+# probably Linux if /usr/bin/coredumpctl exists
+# try raising the core dump size limit to infinite so that when we
+# get a crash we have a chance to retrieve the stack trace
+try:
+import resource
+except ImportError:
+pass
+else:
+try:
+resource.setrlimit(resource.RLIMIT_CORE,
+   (resource.RLIM_INFINITY,
+resource.getrlimit(resource.RLIMIT_CORE)[1]))
+except ValueError:
+# if we can't raise the limit, just forget it
+pass
+
 def ErrExit(msg):
 sys.stderr.write(msg + '\n')
 sys.exit(1)
@@ -1527,6 +1544,18 @@ def returnCode(proc, f = None):
 if proc.returncode == -signal.SIGSEGV:
 if f is not None:
 f.write('\nSegmentation fault\n')
+if os.path.exists('/usr/bin/coredumpctl'):
+# wait a few seconds for the core to be dumped
+time.sleep(10)
+if procdebug:
+print('Starting: coredumpctl info %d' % proc.pid)
+p = process.Popen(['coredumpctl', 'info', str(proc.pid)],
+  stdout = process.PIPE,
+  stderr = process.PIPE,
+  universal_newlines = True)
+out, err = p.communicate()
+if not err and out:
+f.write(out)
 f.flush()
 return 'segfault'   # Segmentation fault
 if proc.returncode == -signal.SIGBUS:
@@ -1537,6 +1566,18 @@ def returnCode(proc, f = None):
 if proc.returncode == -signal.SIGABRT:
 if f is not None:
 f.write('\nAborted\n')
+if os.path.exists('/usr/bin/coredumpctl'):
+# wait a few seconds for the core to be dumped
+time.sleep(10)
+if procdebug:
+print('Starting: coredumpctl info %d' % proc.pid)
+p = process.Popen(['coredumpctl', 'info', str(proc.pid)],
+  stdout = process.PIPE,
+  stderr = process.PIPE,
+  universal_newlines = True)
+out, err = p.communicate()
+if not err and out:
+f.write(out)
 f.flush()
 return 'abort'  # Aborted
 if proc.returncode == -signal.SIGINT:
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Dec2016 - fixed bug 6288, ie meretable wasn't rewritten...

2017-04-19 Thread Niels Nes
Changeset: 6df359498f13 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6df359498f13
Added Files:
sql/test/BugTracker-2017/Tests/function_and_mergetable.Bug-6288.sql

sql/test/BugTracker-2017/Tests/function_and_mergetable.Bug-6288.stable.err

sql/test/BugTracker-2017/Tests/function_and_mergetable.Bug-6288.stable.out
Modified Files:
sql/backends/monet5/rel_bin.c
sql/server/rel_optimizer.c
sql/server/sql_atom.c
sql/test/BugTracker-2017/Tests/All
Branch: Dec2016
Log Message:

fixed bug 6288, ie meretable wasn't rewritten within functions
Found/fixed problem in atom_mul, initialize result type


diffs (235 lines):

diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -4561,7 +4561,7 @@ rel2bin_ddl(mvc *sql, sql_rel *rel, list
sql->type = Q_TABLE;
} else if (rel->flag <= DDL_LIST) {
s = rel2bin_list(sql, rel, refs);
-   } else if (rel->flag <= DDL_PSM) {
+   } else if (rel->flag == DDL_PSM) {
s = rel2bin_psm(sql, rel);
} else if (rel->flag <= DDL_ALTER_SEQ) {
s = rel2bin_seq(sql, rel, refs);
@@ -4898,7 +4898,7 @@ rel_deps(sql_allocator *sa, sql_rel *r, 
return rel_deps(sa, r->l, refs, l);
if (r->r)
return rel_deps(sa, r->r, refs, l);
-   } else if (r->flag <= DDL_PSM) {
+   } else if (r->flag == DDL_PSM) {
exps_deps(sa, r->exps, refs, l);
} else if (r->flag <= DDL_ALTER_SEQ) {
if (r->l)
diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -29,6 +29,7 @@ typedef struct global_props {
 } global_props;
 
 typedef sql_rel *(*rewrite_fptr)(int *changes, mvc *sql, sql_rel *rel);
+typedef sql_rel *(*rewrite_rel_fptr)(mvc *sql, sql_rel *rel, rewrite_fptr 
rewriter, int *has_changes);
 typedef int (*find_prop_fptr)(mvc *sql, sql_rel *rel);
 
 static sql_rel * rewrite_topdown(mvc *sql, sql_rel *rel, rewrite_fptr 
rewriter, int *has_changes);
@@ -8555,6 +8556,36 @@ rel_apply_rewrite(int *changes, mvc *sql
return rel;
 }
 
+static sql_exp *
+rewrite_exp(mvc *sql, sql_exp *e, rewrite_rel_fptr rewrite_rel, rewrite_fptr 
rewriter, int *has_changes)
+{
+   if (e->type != e_psm)
+   return e;
+   if (e->flag & PSM_SET || e->flag & PSM_VAR) 
+   return e;
+   if (e->flag & PSM_RETURN) {
+   e->l = rewrite_exp(sql, e->l, rewrite_rel, rewriter, 
has_changes);
+   }
+   if (e->flag & PSM_WHILE || e->flag & PSM_IF) 
+   return e;
+   if (e->flag & PSM_REL) 
+   e->l = rewrite_rel(sql, e->l, rewriter, has_changes);
+   return e;
+}
+
+static list *
+rewrite_exps(mvc *sql, list *l, rewrite_rel_fptr rewrite_rel, rewrite_fptr 
rewriter, int *has_changes)
+{
+   node *n;
+
+   if (!l)
+   return l;
+   for(n = l->h; n; n = n->next) 
+   n->data = rewrite_exp(sql, n->data, rewrite_rel, rewriter, 
has_changes);
+   return l;
+}
+
+
 static sql_rel *
 rewrite(mvc *sql, sql_rel *rel, rewrite_fptr rewriter, int *has_changes) 
 {
@@ -8590,6 +8621,8 @@ rewrite(mvc *sql, sql_rel *rel, rewrite_
rel->l = rewrite(sql, rel->l, rewriter, has_changes);
break;
case op_ddl: 
+   if (rel->flag == DDL_PSM && rel->exps) 
+   rel->exps = rewrite_exps(sql, rel->exps, &rewrite, 
rewriter, has_changes);
rel->l = rewrite(sql, rel->l, rewriter, has_changes);
if (rel->r)
rel->r = rewrite(sql, rel->r, rewriter, has_changes);
@@ -8647,6 +8680,8 @@ rewrite_topdown(mvc *sql, sql_rel *rel, 
rel->l = rewrite_topdown(sql, rel->l, rewriter, has_changes);
break;
case op_ddl: 
+   if (rel->flag == DDL_PSM && rel->exps) 
+   rewrite_exps(sql, rel->exps, &rewrite_topdown, 
rewriter, has_changes);
rel->l = rewrite_topdown(sql, rel->l, rewriter, has_changes);
if (rel->r)
rel->r = rewrite_topdown(sql, rel->r, rewriter, 
has_changes);
diff --git a/sql/server/sql_atom.c b/sql/server/sql_atom.c
--- a/sql/server/sql_atom.c
+++ b/sql/server/sql_atom.c
@@ -1210,12 +1210,13 @@ atom *
 atom_mul(atom *a1, atom *a2)
 {
ValRecord dst;
+
if (!EC_COMPUTE(a1->tpe.type->eclass))
return NULL;
if (a1->tpe.type->localtype == TYPE_dbl ||
a2->tpe.type->localtype == TYPE_dbl) {
ValRecord v1, v2;
-   v1.vtype = v2.vtype = TYPE_dbl;
+   dst.vtype = v1.vtype = v2.vtype = TYPE_dbl;
v1.val.dval = a1

MonetDB: leftmart - change the sort call for ordered idx

2017-04-19 Thread lsidir
Changeset: 8ee5c9186c2b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ee5c9186c2b
Modified Files:
gdk/gdk_select.c
Branch: leftmart
Log Message:

change the sort call for ordered idx


diffs (18 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -1732,12 +1732,11 @@ BATselect(BAT *b, BAT *s, const void *tl
bn->tnil = 0;
bn->tnonil = 1;
/* output must be sorted */
-   /*
GDKqsort((oid *) Tloc(bn, 0), NULL, NULL, 
(size_t) bn->batCount, sizeof(oid), 0, TYPE_oid);
bn->tsorted = 1;
bn->trevsorted = bn->batCount <= 1;
-   bn->tseqbase = (bn->tdense = bn->batCount <= 1) 
!= 0 ? 0 : oid_nil;*/
-   sort_cand(bn,BATcount(b));
+   bn->tseqbase = (bn->tdense = bn->batCount <= 1) 
!= 0 ? 0 : oid_nil;
+   //sort_cand(bn,BATcount(b));
} else {
/* match: [low..high) */
if (s) {
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: leftmart - making ordered_idx to work with non-dense ca...

2017-04-19 Thread lsidir
Changeset: d195532c7b67 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d195532c7b67
Modified Files:
gdk/gdk_select.c
Branch: leftmart
Log Message:

making ordered_idx to work with non-dense cand lists


diffs (201 lines):

diff --git a/gdk/gdk_select.c b/gdk/gdk_select.c
--- a/gdk/gdk_select.c
+++ b/gdk/gdk_select.c
@@ -150,45 +150,69 @@ doubleslice(BAT *b, BUN l1, BUN h1, BUN 
 }
 
 static BAT *
-sort_cand(BAT *b, BUN cnt)
+sort_cand(BAT *bn, BAT *s, BUN cnt)
 {
-   BAT *bn;
-   const oid *restrict o;
-   oid *restrict p;
+   oid *restrict o;
unsigned char *bitvector;
-   BUN i,sz_b;
+   BUN i, cnt_b, new_cnt;
 
 #define remainder8(X)   ((X) &  7)
 #define quotient8(X)((X) >> 3)
 
/* input must be a potential candidate list or NULL */
-   assert(b == NULL ||
-  (((b->ttype == TYPE_void && b->tseqbase != oid_nil) ||
-b->ttype == TYPE_oid) &&
-b->tkey));
+   assert(bn == NULL ||
+  (((bn->ttype == TYPE_void && bn->tseqbase != oid_nil) ||
+bn->ttype == TYPE_oid) &&
+bn->tkey));
 
-   sz_b = BATcount(b);
+   /* s is a candidate list to be merged with bn */
+   assert(s == NULL || s->ttype == TYPE_oid || s->ttype == TYPE_void);
+   if (s && !BATtordered(s)) {
+   GDKerror("sort_cand: invalid argument: "
+"s must be sorted.\n");
+   return NULL;
+   }
+
+   cnt_b = BATcount(bn);
bitvector = (unsigned char *) GDKzalloc(cnt/8+1);
if (bitvector == NULL) {
GDKerror("#sort_cand: memory allocation error");
return NULL;
}
 
-   o = (oid *) Tloc(b,0);
-   for (i=0; i < sz_b; i++) {
+   o = (oid *) Tloc(bn,0);
+   for (i=0; i < cnt_b; i++) {
bitvector[quotient8(o[i])] |= (1trevsorted = bn->batCount <= 1;
bn->tkey = 1;
@@ -1482,11 +1506,12 @@ BATselect(BAT *b, BAT *s, const void *tl
/* If there is an order index or it is a view and the parent has an 
ordered
 * index, and the bat is not tsorted or trevstorted then use the order
 * index.
-* And there is no cand list or if there is one, it is dense.
+* //And there is no cand list or if there is one, it is dense.
+* trying to make it work for all cand list cases now.
 * TODO: we do not support anti-select with order index */
if (!anti &&
!(b->tsorted || b->trevsorted) &&
-   (!s || (s && BATtdense(s)))&&
+   //(!s || (s && BATtdense(s)))&&
(BATcheckorderidx(b) ||
 (VIEWtparent(b) && BATcheckorderidx(BBPquickdesc(VIEWtparent(b), 
0)
{
@@ -1497,9 +1522,10 @@ BATselect(BAT *b, BAT *s, const void *tl
}
/* Is query selective enough to use the ordered index ? */
/* TODO: Test if this heuristic works in practice */
+   /* if there is a orderidx, use it! */
/*if ((ORDERfnd(b, th) - ORDERfnd(b, tl)) < ((BUN)1000 < 
b->batCount/1000 ? (BUN)1000: b->batCount/1000))*/
-   if ((ORDERfnd(b, th) - ORDERfnd(b, tl)) < b->batCount/3)
-   {
+   //if ((ORDERfnd(b, th) - ORDERfnd(b, tl)) < b->batCount/3)
+   //{
use_orderidx = 1;
if (view) {
vwl = view->hseqbase;
@@ -1508,11 +1534,11 @@ BATselect(BAT *b, BAT *s, const void *tl
vwl = b->hseqbase;
vwh = vwl + b->batCount;
}
-   } else {
+   /*} else {
if (view) {
b = view;
}
-   }
+   }*/
}
 
if (BATordered(b) || BATordered_rev(b) || use_orderidx) {
@@ -1605,7 +1631,7 @@ BATselect(BAT *b, BAT *s, const void *tl
}
} else {
assert(use_orderidx);
-   ALGODEBUG fprintf(stderr, "#BATsubselect(b=%s#" BUNFMT
+   ALGODEBUG fprintf(stderr, "#BATselect(b=%s#" BUNFMT
  ",s=%s%s,anti=%d): orderidx\n",
  BATgetId(b), BATcount(b),
  s ? BATgetId(s) : "NULL",
@@ -1696,7 +1722,7 @@ BATselect(BAT *b, BAT *s, const void *tl
 
rbn = (oid *) Tloc((bn), 0);
 
-   if (s && !BATtdense(s)) {
+   /*if (s && !BATtdense(s)) {
const oid *rcand = (const oid *) 
Tloc((s), 0);
assert("should not use orderidx with 
non dense cand list, too expensive");
 
@@ -1711,13 +1737,2

MonetDB: Dec2016 - fixed bug 6260, ie crash in the in type check...

2017-04-19 Thread Niels Nes
Changeset: c150cc9de5d5 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c150cc9de5d5
Added Files:
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.sql
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
Modified Files:
sql/server/rel_select.c
sql/test/BugTracker-2016/Tests/storagemodel.stable.out
sql/test/BugTracker-2017/Tests/All
Branch: Dec2016
Log Message:

fixed bug 6260, ie crash in the in type checking.
approved output (properties aren't stable?)


diffs (153 lines):

diff --git a/sql/server/rel_select.c b/sql/server/rel_select.c
--- a/sql/server/rel_select.c
+++ b/sql/server/rel_select.c
@@ -2054,7 +2054,7 @@ rel_logical_value_exp(mvc *sql, sql_rel 
sql_rel *z = NULL, *rl;
 
r = rel_value_exp(sql, &z, sval, f, ek);
-   if (l && IS_ANY(st->type->eclass)){
+   if (l && r && IS_ANY(st->type->eclass)){
l = rel_check_type(sql, exp_subtype(r), 
l, type_equal);
if (l)
st = exp_subtype(l);
diff --git a/sql/test/BugTracker-2016/Tests/storagemodel.stable.out 
b/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
--- a/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
+++ b/sql/test/BugTracker-2016/Tests/storagemodel.stable.out
@@ -100,7 +100,7 @@ Ready.
 [ "sys",   "_tables",  "name", "varchar",  "writable", 8,  
0,  false,  0,  false   ]
 [ "sys",   "_tables",  "schema_id","int",  "writable", 4,  
0,  false,  0,  NULL]
 [ "sys",   "_tables",  "query","varchar",  "writable", 
45, 0,  false,  0,  NULL]
-[ "sys",   "_tables",  "type", "smallint", "writable", 2,  
0,  false,  0,  NULL]
+[ "sys",   "_tables",  "type", "smallint", "writable", 2,  
0,  false,  0,  false   ]
 [ "sys",   "_tables",  "system",   "boolean",  "writable", 
1,  0,  false,  0,  NULL]
 [ "sys",   "_tables",  "commit_action","smallint", 
"writable", 2,  0,  false,  0,  NULL]
 [ "sys",   "_tables",  "access",   "smallint", "writable", 
2,  0,  false,  0,  true]
diff --git a/sql/test/BugTracker-2017/Tests/All 
b/sql/test/BugTracker-2017/Tests/All
--- a/sql/test/BugTracker-2017/Tests/All
+++ b/sql/test/BugTracker-2017/Tests/All
@@ -33,3 +33,4 @@ fullouterjoinfilter.Bug-6256
 wrong_aggregation_count.Bug-6257
 select.Bug-6259
 function_and_mergetable.Bug-6288
+crash_in_in_handling.Bug-6260
diff --git a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.sql 
b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.sql
@@ -0,0 +1,16 @@
+CREATE TABLE tab0(pk INTEGER PRIMARY KEY, col0 INTEGER, col1 FLOAT, col2 TEXT, 
col3 INTEGER, col4 FLOAT, col5 TEXT);
+
+INSERT INTO tab0 VALUES(0,698,169.42,'apdbu',431,316.15,'sqvis');
+INSERT INTO tab0 VALUES(1,538,676.36,'fuqeu',514,685.97,'bgwrq');
+INSERT INTO tab0 VALUES(2,90,205.26,'yrrzx',123,836.88,'kpuhc');
+INSERT INTO tab0 VALUES(3,620,864.8,'myrdv',877,820.98,'oxkuv');
+INSERT INTO tab0 VALUES(4,754,677.3,'iofrg',67,665.49,'bzqba');
+INSERT INTO tab0 VALUES(5,107,710.19,'lhfro',286,504.28,'kwwsg');
+INSERT INTO tab0 VALUES(6,904,193.16,'eozui',48,698.55,'ejyzs');
+INSERT INTO tab0 VALUES(7,606,650.64,'ovmce',417,962.43,'dvkbh');
+INSERT INTO tab0 VALUES(8,535,18.11,'ijika',630,489.63,'hpnyu');
+INSERT INTO tab0 VALUES(9,501,776.40,'cvygg',725,75.5,'etlyv');
+
+SELECT * FROM tab0 AS cor0 WHERE NOT NULL IN ( col3 );
+
+drop table tab0;
diff --git 
a/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err 
b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
new file mode 100644
--- /dev/null
+++ b/sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
@@ -0,0 +1,37 @@
+stderr of test 'crash_in_in_handling.Bug-6260` in directory 
'sql/test/BugTracker-2017` itself:
+
+
+# 14:07:27 >  
+# 14:07:27 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=39677" "--set" 
"mapi_usock=/var/tmp/mtest-29945/.s.monetdb.39677" "--set" "monet_prompt=" 
"--forcemito" 
"--dbpath=/home/niels/scratch/rc-clean/Linux-x86_64/var/MonetDB/mTests_sql_test_BugTracker-2017"
+# 14:07:27 >  
+
+# builtin opt  gdk_dbpath = 
/home/niels/scratch/rc-clean/Linux-x86_64/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin o

MonetDB: Dec2016 - Test for liblas/capi/liblas.h include file se...

2017-04-19 Thread Sjoerd Mullender
Changeset: 4c80241c0c5b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4c80241c0c5b
Modified Files:
configure.ag
Branch: Dec2016
Log Message:

Test for liblas/capi/liblas.h include file separately.
This fixes bug 6180.


diffs (38 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2212,6 +2212,21 @@ AS_CASE([$have_lidar],
AS_VAR_IF([have_liblas], [no], [], [
LIBLAS_INCS=`$LIBLAS_CONFIG --includes`
LIBLAS_LIBS=`$LIBLAS_CONFIG --libs`])
+   # liblas-config and liblas/capi/liblas.h could be in different
+   # packages (think Ubuntu) so we need to test for them both
+   AS_VAR_IF([have_liblas], [no], [], [
+   save_CPPFLAGS="$CPPFLAGS"
+   save_LDFLAGS="$LDFLAGS"
+   save_LIBS="$LIBS"
+   CPPFLAGS="$CPPFLAGS $LIBLAS_INCS"
+   LDFLAGS="$LDFLAGS $LIBLAS_LIBS"
+   LIBS=""
+   AC_CHECK_HEADER([liblas/capi/liblas.h], [],
+   [have_liblas=no
+why_have_liblas="(liblas/capi/liblas.h header file not 
found)"])
+   CPPFLAGS="$save_CPPFLAGS"
+   LDFLAGS="$save_LDFLAGS"
+   LIBS="$save_LIBS"])
# if lidar is enabled and liblas was not found abort
AS_VAR_IF([have_liblas], [no], [
AS_VAR_IF([have_lidar], [yes],
@@ -2232,12 +2247,9 @@ AC_SUBST([LIBLAS_RPM])
 
 AC_SUBST([LIBLAS_INCS])
 AC_SUBST([LIBLAS_LIBS])
-AC_MSG_CHECKING([enable lidar: $have_lidar])
 
 AM_CONDITIONAL([HAVE_LIDAR], [test "x$have_lidar" = xyes -o "x$have_lidar" = 
xauto])
 
-AC_MSG_CHECKING(['enable lidar: $have_lidar'])
-
 # gdal
 org_have_gdal="auto"
 have_gdal=$org_have_gdal
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: Dec2016 - Don't return a pointer into freed memory.

2017-04-19 Thread Sjoerd Mullender
Changeset: caa5eb85cec4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=caa5eb85cec4
Modified Files:
monetdb5/mal/mal_parser.c
Branch: Dec2016
Log Message:

Don't return a pointer into freed memory.
This fixes bug 6176.


diffs (43 lines):

diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1134,6 +1134,7 @@ fcnHeader(Client cntxt, int kind)
freeSymbol(cntxt->curprg);
cntxt->curprg = cntxt->backup;
cntxt->backup = 0;
+   curBlk = NULL;
}
parseError(cntxt, "',' expected\n");
skipToEnd(cntxt);
@@ -1149,6 +1150,7 @@ fcnHeader(Client cntxt, int kind)
freeSymbol(cntxt->curprg);
cntxt->curprg = cntxt->backup;
cntxt->backup = 0;
+   curBlk = NULL;
}
parseError(cntxt, "')' expected\n");
skipToEnd(cntxt);
@@ -1191,6 +1193,7 @@ fcnHeader(Client cntxt, int kind)
freeSymbol(cntxt->curprg);
cntxt->curprg = cntxt->backup;
cntxt->backup = 0;
+   curBlk = NULL;
}
parseError(cntxt, "',' expected\n");
skipToEnd(cntxt);
@@ -1210,6 +1213,7 @@ fcnHeader(Client cntxt, int kind)
freeSymbol(cntxt->curprg);
cntxt->curprg = cntxt->backup;
cntxt->backup = 0;
+   curBlk = NULL;
}
skipToEnd(cntxt);
return curBlk;
@@ -1231,6 +1235,7 @@ fcnHeader(Client cntxt, int kind)
freeSymbol(cntxt->curprg);
cntxt->curprg = cntxt->backup;
cntxt->backup = 0;
+   curBlk = NULL;
}
parseError(cntxt, "')' expected\n");
skipToEnd(cntxt);
___
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list


MonetDB: default - Merge with Dec2016 branch.

2017-04-19 Thread Sjoerd Mullender
Changeset: 15f6abfbff85 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=15f6abfbff85
Added Files:
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.sql
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.err
sql/test/BugTracker-2017/Tests/crash_in_in_handling.Bug-6260.stable.out
sql/test/BugTracker-2017/Tests/function_and_mergetable.Bug-6288.sql

sql/test/BugTracker-2017/Tests/function_and_mergetable.Bug-6288.stable.err

sql/test/BugTracker-2017/Tests/function_and_mergetable.Bug-6288.stable.out
sql/test/leaks/Tests/check1.reqtests
sql/test/leaks/Tests/check1.sql
sql/test/leaks/Tests/check2.reqtests
sql/test/leaks/Tests/check3.reqtests
sql/test/leaks/Tests/check4.reqtests
sql/test/leaks/Tests/check5.reqtests
sql/test/leaks/Tests/drop3.reqtests
sql/test/leaks/Tests/initialize.sql
sql/test/leaks/Tests/initialize.stable.err
sql/test/leaks/Tests/initialize.stable.out
sql/test/leaks/Tests/select1.reqtests
sql/test/leaks/Tests/select2.reqtests
sql/test/leaks/Tests/temp1.reqtests
sql/test/leaks/Tests/temp2.reqtests
sql/test/leaks/Tests/temp3.reqtests
Removed Files:
sql/test/leaks/Tests/check0.sql
sql/test/leaks/Tests/check0.stable.err
sql/test/leaks/Tests/check0.stable.out
sql/test/leaks/Tests/check0.stable.out.int128
sql/test/leaks/Tests/check1.sql.src
Modified Files:
configure.ag
monetdb5/ChangeLog.Dec2016
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_stack.c
sql/backends/monet5/rel_bin.c
sql/server/rel_optimizer.c
sql/server/rel_select.c
sql/server/sql_atom.c
sql/test/BugTracker-2016/Tests/storagemodel.stable.out
sql/test/BugTracker-2017/Tests/All
sql/test/leaks/Tests/All
sql/test/leaks/Tests/check1.stable.out
sql/test/leaks/Tests/check2.sql.src
sql/test/leaks/Tests/check2.stable.out
sql/test/leaks/Tests/check3.sql.src
sql/test/leaks/Tests/check3.stable.out
sql/test/leaks/Tests/check4.sql.src
sql/test/leaks/Tests/check4.stable.out
sql/test/leaks/Tests/check5.sql.src
sql/test/leaks/Tests/check5.stable.out
sql/test/leaks/Tests/drop3.stable.out
sql/test/leaks/Tests/drop3.stable.out.int128
sql/test/leaks/Tests/select1.stable.out
sql/test/leaks/Tests/select2.stable.out
sql/test/leaks/Tests/temp1.stable.out
sql/test/leaks/Tests/temp1.stable.out.int128
testing/Mtest.py.in
Branch: default
Log Message:

Merge with Dec2016 branch.


diffs (truncated from 1445 to 300 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2382,6 +2382,21 @@ AS_CASE([$have_lidar],
AS_VAR_IF([have_liblas], [no], [], [
LIBLAS_INCS=`$LIBLAS_CONFIG --includes`
LIBLAS_LIBS=`$LIBLAS_CONFIG --libs`])
+   # liblas-config and liblas/capi/liblas.h could be in different
+   # packages (think Ubuntu) so we need to test for them both
+   AS_VAR_IF([have_liblas], [no], [], [
+   save_CPPFLAGS="$CPPFLAGS"
+   save_LDFLAGS="$LDFLAGS"
+   save_LIBS="$LIBS"
+   CPPFLAGS="$CPPFLAGS $LIBLAS_INCS"
+   LDFLAGS="$LDFLAGS $LIBLAS_LIBS"
+   LIBS=""
+   AC_CHECK_HEADER([liblas/capi/liblas.h], [],
+   [have_liblas=no
+why_have_liblas="(liblas/capi/liblas.h header file not 
found)"])
+   CPPFLAGS="$save_CPPFLAGS"
+   LDFLAGS="$save_LDFLAGS"
+   LIBS="$save_LIBS"])
# if lidar is enabled and liblas was not found abort
AS_VAR_IF([have_liblas], [no], [
AS_VAR_IF([have_lidar], [yes],
@@ -2402,12 +2417,9 @@ AC_SUBST([LIBLAS_RPM])
 
 AC_SUBST([LIBLAS_INCS])
 AC_SUBST([LIBLAS_LIBS])
-AC_MSG_CHECKING([enable lidar: $have_lidar])
 
 AM_CONDITIONAL([HAVE_LIDAR], [test "x$have_lidar" = xyes -o "x$have_lidar" = 
xauto])
 
-AC_MSG_CHECKING(['enable lidar: $have_lidar'])
-
 # gdal
 org_have_gdal="auto"
 have_gdal=$org_have_gdal
diff --git a/monetdb5/ChangeLog.Dec2016 b/monetdb5/ChangeLog.Dec2016
--- a/monetdb5/ChangeLog.Dec2016
+++ b/monetdb5/ChangeLog.Dec2016
@@ -1,3 +1,7 @@
 # ChangeLog file for MonetDB5
 # This file is updated with Maddlog
 
+* Wed Apr 19 2017 Sjoerd Mullender 
+- Fixed a bug causing a crash during cleanup when mserver5 is stopped
+  with monetdb stop database.
+
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1129,6 +1129,7 @@ fcnHeader(Client cntxt, int kind)
freeSymbol(cntxt->curprg);
cntxt->curprg = cntxt->backup;
cntxt->backup = 0;
+ 

MonetDB: batcalc-candidates - Merge with default branch.

2017-04-19 Thread Sjoerd Mullender
Changeset: 26e8fb76f571 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=26e8fb76f571
Added Files:
monetdb5/extras/rapi/Tests/rapi02.stable.out.int128
monetdb5/mal/Tests/malids.malC
monetdb5/mal/Tests/malids.stable.err
monetdb5/mal/Tests/malids.stable.out
monetdb5/modules/atoms/Tests/strappend.malC
monetdb5/modules/atoms/Tests/strappend.stable.err
monetdb5/modules/atoms/Tests/strappend.stable.out
monetdb5/modules/kernel/Tests/select.malC
monetdb5/modules/kernel/Tests/select.stable.err
monetdb5/modules/kernel/Tests/select.stable.out
monetdb5/optimizer/Tests/tst4006.malC
monetdb5/optimizer/Tests/tst4006.stable.err
monetdb5/optimizer/Tests/tst4006.stable.out
sql/backends/monet5/Tests/int_notation_1e5.stable.out.int128
sql/backends/monet5/Tests/pyloader06.stable.out.Windows
sql/backends/monet5/Tests/pyloader07.stable.out.Windows
sql/backends/monet5/UDF/pyapi/Tests/pyapi_types_huge.stable.out.int128
sql/backends/monet5/UDF/pyapi3/50_pyapi3.mal
sql/backends/monet5/UDF/pyapi3/Makefile.ag
sql/backends/monet5/UDF/pyapi3/Tests/All
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_00.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_00.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_00.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_01.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_01.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_01.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_02.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_02.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_02.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_03.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_03.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_03.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_04.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_04.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_04.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_05.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_05.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_05.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_06.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_06.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_06.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_07.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_07.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_07.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_09.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_09.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_09.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_10.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_10.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_10.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_11.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_11.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_11.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_12.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_12.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_12.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_13.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_13.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_13.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_15.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_16.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_16.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_16.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_17.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_18.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_19.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_20.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_20.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_20.stable.out
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_21.SQL.sh
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_21.stable.err
sql/backends/monet5/UDF/pyapi3/Tests/pyapi3_21.stable.out
sql/backends/monet5/UDF/p

MonetDB: malparsing - Fixing variable resetting

2017-04-19 Thread Martin Kersten
Changeset: 688b7bd6 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=688b7bd6
Modified Files:
monetdb5/mal/Tests/dynamicload.stable.err
monetdb5/mal/mal_parser.c
monetdb5/mal/mal_session.c
Branch: malparsing
Log Message:

Fixing variable resetting
that caused unexpected syntax errors on RETURN missing


diffs (126 lines):

diff --git a/monetdb5/mal/Tests/dynamicload.stable.err 
b/monetdb5/mal/Tests/dynamicload.stable.err
--- a/monetdb5/mal/Tests/dynamicload.stable.err
+++ b/monetdb5/mal/Tests/dynamicload.stable.err
@@ -91,8 +91,8 @@ QUERY = # examples of non-bindable instr
 comment "Should not be callable";
 
 wrong();
-ERROR = !SyntaxException:include UNKNOWlib;
-!SyntaxException:^18 MALException:mal.import:#WARNING: could not open 
file: UNKNOWlib
+
+!SyntaxException:^19 MALException:mal.import:#WARNING: could not open 
file: UNKNOWlib
 !TypeException:user.main[1]:object code for command user.wrong missing
 !TypeException:user.main[1]:'user.wrong' undefined in: 
user.wrong();
 
diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c
--- a/monetdb5/mal/mal_parser.c
+++ b/monetdb5/mal/mal_parser.c
@@ -1271,7 +1271,8 @@ parseEnd(Client cntxt)
cntxt->backup->def->errors = 
GDKstrdup(cntxt->curprg->def->errors);
 cntxt->curprg = cntxt->backup;
 cntxt->backup = 0;
-}
+}  else
+   (void) MSinitClientPrg(cntxt,"user","main");
return 1;
}
return 0;
diff --git a/monetdb5/mal/mal_session.c b/monetdb5/mal/mal_session.c
--- a/monetdb5/mal/mal_session.c
+++ b/monetdb5/mal/mal_session.c
@@ -145,14 +145,17 @@ MSresetClientPrg(Client cntxt, str mod, 
 str
 MSinitClientPrg(Client cntxt, str mod, str nme)
 {
+   int idx;
+
if (cntxt->curprg  && idcmp(nme, cntxt->curprg->name) == 0)
return MSresetClientPrg(cntxt, putName(mod), putName(nme));
cntxt->curprg = newFunction(putName(mod), putName(nme), FUNCTIONsymbol);
-   if( strcmp(mod,"user")==0 && strcmp(nme,"main")==0)
-   setVarType(cntxt->curprg->def, 
findVariable(cntxt->curprg->def,"main"), TYPE_void);
+   if( (idx= findVariable(cntxt->curprg->def,"main")) >=0)
+   setVarType(cntxt->curprg->def, idx, TYPE_void);
+   insertSymbol(cntxt->usermodule,cntxt->curprg);
+   
if( cntxt->curprg == 0)
throw(MAL, "initClientPrg", MAL_MALLOC_FAIL);
-   
if (cntxt->glb == NULL )
cntxt->glb = newGlobalStack(MAXGLOBALS + 
cntxt->curprg->def->vsize);
if( cntxt->glb == NULL)
@@ -415,9 +418,8 @@ MSresetVariables(Client cntxt, MalBlkPtr
 #ifdef _DEBUG_SESSION_
fprintf(stderr,"resetVarables %d  vtop %d errors %s\n", start, 
mb->vtop,mb->errors);
 #endif
-   if( start <= mb->vtop)
-   for (i = 0; i < start ; i++)
-   setVarUsed(mb,i);
+   for (i = 0; i < start && i < mb->vtop ; i++)
+   setVarUsed(mb,i);
if (mb->errors == MAL_SUCCEED)
for (i = start; i < mb->vtop; i++) {
if (isVarUsed(mb,i) || !isTmpVar(mb,i)){
@@ -581,6 +583,7 @@ MALreader(Client c)
 {  str s,l;
int string = 0;
int blocked;
+   ssize_t nr =0;
 
// First eat away any left over input
if( c->linefill)
@@ -590,7 +593,6 @@ MALreader(Client c)
do{
blocked = isa_block_stream(c->fdin->s);
if(c->fdin->pos >= c->fdin->len ){
-   ssize_t nr = 0;
if(c->fdin->eof && c->prompt ){
if (!blocked)
mnstr_write(c->fdout, c->prompt, 
strlen(c->prompt), 1);
@@ -660,13 +662,23 @@ MALreader(Client c)
if (!string && *l == '#' ){
c->fdin->pos++;
// eat everything away until end of line
-   for(l++ ; *l && c->fdin->pos < c->fdin->len ; 
l++){
+   l++;
+   continuecomment:
+   for(; *l && c->fdin->pos < c->fdin->len ; l++){
if ( c->listing)
mnstr_printf(c->fdout,"%c", *l);
c->fdin->pos++;
if (*l == '\n' ||  *l == '\r' )
break;
}
+   // check for non-terminated comment before 
continuing
+   if ( *l != '\n' && *l != '\r' && blocked ){
+   nr = bstream_next(c->fdin); // check 
for eof 
+   if (c->fdin->eof)
+