Changeset: 409d381226f2 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=409d381226f2 Added Files: sql/test/Tests/alastair_udf_mergetable_bug.py sql/test/Tests/alastair_udf_mergetable_bug.stable.err sql/test/Tests/alastair_udf_mergetable_bug.stable.out Modified Files: clients/mapiclient/mclient.c gdk/gdk_bbp.c gdk/gdk_heap.c gdk/gdk_storage.c monetdb5/mal/Tests/tst013.stable.out monetdb5/mal/Tests/tst036.stable.out monetdb5/mal/Tests/tst050.stable.out monetdb5/mal/Tests/tst070.stable.out monetdb5/mal/Tests/tst105.stable.out monetdb5/mal/Tests/tst106.stable.out monetdb5/mal/Tests/tst150.stable.out monetdb5/mal/Tests/tst2504.mal monetdb5/mal/Tests/tst2504.stable.out monetdb5/mal/Tests/tst611.stable.out monetdb5/mal/mal_import.c monetdb5/mal/mal_instruction.c monetdb5/modules/atoms/str.c monetdb5/modules/mal/bbp.c monetdb5/optimizer/Tests/inline08.stable.out monetdb5/optimizer/opt_accumulators.c monetdb5/optimizer/opt_aliases.c monetdb5/optimizer/opt_pushselect.c monetdb5/scheduler/srvpool.c monetdb5/tests/BugDay_2005-10-06_4.9.3/Tests/ADT_not_available.SF-850137.stable.out monetdb5/tests/BugReports/Tests/lngssaretruncated.stable.out monetdb5/tests/BugTracker/Tests/parser.SF-2051309.stable.out sql/backends/monet5/sql.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_scenario.c sql/test/BugTracker-2012/Tests/table_function_with_column_subselects.Bug-3172.stable.err testing/process.py tools/mserver/mserver5.c Branch: default Log Message:
Merge with Jan2014 branch. diffs (truncated from 856 to 300 lines): diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -1643,7 +1643,7 @@ doRequest(Mapi mid, const char *buf) return 0; } -#define CHECK_RESULT(mid, hdl, buf, break_or_continue) \ +#define CHECK_RESULT(mid, hdl, buf, break_or_continue,freebuf) \ switch (mapi_error(mid)) { \ case MOK: \ /* everything A OK */ \ @@ -1678,7 +1678,7 @@ doRequest(Mapi mid, const char *buf) mapi_explain(mid, stderr); \ errseen = 1; \ timerEnd(); \ - free(buf); \ + if( freebuf) free(freebuf); \ return 1; \ } @@ -1725,7 +1725,7 @@ doFileBulk(Mapi mid, FILE *fp) if (hdl == NULL) { hdl = mapi_query_prep(mid); - CHECK_RESULT(mid, hdl, buf, continue); + CHECK_RESULT(mid, hdl, buf, continue, buf); } if (first && @@ -1739,7 +1739,7 @@ doFileBulk(Mapi mid, FILE *fp) assert(hdl != NULL); mapi_query_part(hdl, buf + skip, length - skip); - CHECK_RESULT(mid, hdl, buf + skip, continue); + CHECK_RESULT(mid, hdl, buf + skip, continue, buf); /* make sure there is a newline in the buffer */ if (strchr(buf + skip, '\n') == NULL) @@ -1758,14 +1758,14 @@ doFileBulk(Mapi mid, FILE *fp) (length > 0 || mapi_query_done(hdl) == MMORE)) continue; /* get more data */ - CHECK_RESULT(mid, hdl, buf + skip, continue); + CHECK_RESULT(mid, hdl, buf + skip, continue, buf); rc = format_result(mid, hdl, 0); if (rc == MMORE && (length > 0 || mapi_query_done(hdl) != MOK)) continue; /* get more data */ - CHECK_RESULT(mid, hdl, buf + skip, continue); + CHECK_RESULT(mid, hdl, buf + skip, continue, buf); mapi_close_handle(hdl); hdl = NULL; @@ -2321,7 +2321,7 @@ doFile(Mapi mid, const char *file, int u "" : "AND system = false")); hdl = mapi_query(mid, q); - CHECK_RESULT(mid, hdl, buf, continue); + CHECK_RESULT(mid, hdl, buf, continue, buf); while (fetch_row(hdl) == 5) { name = mapi_fetch_field(hdl, 0); type = mapi_fetch_field(hdl, 1); @@ -2509,7 +2509,7 @@ doFile(Mapi mid, const char *file, int u if (hdl == NULL) { timerStart(); hdl = mapi_query_prep(mid); - CHECK_RESULT(mid, hdl, buf, continue); + CHECK_RESULT(mid, hdl, buf, continue, buf); } else timerResume(); @@ -2518,7 +2518,7 @@ doFile(Mapi mid, const char *file, int u if (length > 0) { SQLsetSpecial(line); mapi_query_part(hdl, line, length); - CHECK_RESULT(mid, hdl, buf, continue); + CHECK_RESULT(mid, hdl, buf, continue, buf); } /* If the server wants more but we're at the @@ -2536,7 +2536,7 @@ doFile(Mapi mid, const char *file, int u continue; /* done */ } } - CHECK_RESULT(mid, hdl, buf, continue); + CHECK_RESULT(mid, hdl, buf, continue, buf); if (mapi_get_querytype(hdl) == Q_PREPARE) { prepno = mapi_get_tableid(hdl); @@ -2548,7 +2548,7 @@ doFile(Mapi mid, const char *file, int u if (rc == MMORE && (line != NULL || mapi_query_done(hdl) != MOK)) continue; /* get more data */ - CHECK_RESULT(mid, hdl, buf, continue); + CHECK_RESULT(mid, hdl, buf, continue, buf); timerEnd(); mapi_close_handle(hdl); diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c --- a/gdk/gdk_bbp.c +++ b/gdk/gdk_bbp.c @@ -411,8 +411,8 @@ recover_dir(int direxists) { if (direxists) { /* just try; don't care about these non-vital files */ - GDKunlink(BATDIR, "BBP", "bak"); - GDKmove(BATDIR, "BBP", "dir", BATDIR, "BBP", "bak"); + (void) GDKunlink(BATDIR, "BBP", "bak"); + (void) GDKmove(BATDIR, "BBP", "dir", BATDIR, "BBP", "bak"); } return GDKmove(BAKDIR, "BBP", "dir", BATDIR, "BBP", "dir"); } @@ -3142,14 +3142,11 @@ BBPprepare(bit subcommit) ret = (BBPrecover_subdir() < 0); } if (backup_files == 0) { - struct stat st; - backup_dir = 0; - ret = (stat(BAKDIR, &st) == 0 && BBPrecover()); - + ret = BBPrecover(); if (ret == 0) { - /* make a new BAKDIR */ - ret = mkdir(BAKDIR, 0755); + ret = (mkdir(BAKDIR, 0755) < 0 && errno != EEXIST); + /* if BAKDIR already exists, don't signal error */ IODEBUG THRprintf(GDKstdout, "#mkdir %s = %d\n", BAKDIR, ret); } } @@ -3404,7 +3401,6 @@ force_move(const char *srcdir, const cha if ((p = strrchr(name, '.')) != NULL && strcmp(p, ".kill") == 0) { /* Found a X.new.kill file, ie remove the X.new file */ - struct stat st; ptrdiff_t len = p - name; strncpy(srcpath, name, len); @@ -3413,23 +3409,19 @@ force_move(const char *srcdir, const cha /* step 1: remove the X.new file that is going to be * overridden by X */ - if (stat(dstpath, &st) == 0) { - ret = unlink(dstpath); /* clear destination */ - if (ret) { - /* if it exists and cannot be removed, - * all this is going to fail */ - GDKsyserror("force_move: unlink(%s)\n", dstpath); - return ret; - } + if (unlink(dstpath) < 0 && errno != ENOENT) { + /* if it exists and cannot be removed, all + * this is going to fail */ + GDKsyserror("force_move: unlink(%s)\n", dstpath); + return -1; } /* step 2: now remove the .kill file. This one is * crucial, otherwise we'll never finish recovering */ GDKfilepath(killfile, srcdir, name, NULL); - ret = unlink(killfile); - if (ret) { + if (unlink(killfile) < 0) { GDKsyserror("force_move: unlink(%s)\n", killfile); - return ret; + return -1; } return 0; } @@ -3642,7 +3634,6 @@ BBPdiskscan(const char *parent) const char *p; bat bid; int ok, delete; - struct stat st; if (dent->d_name[0] == '.') continue; /* ignore .dot files and directories (. ..) */ @@ -3672,11 +3663,6 @@ BBPdiskscan(const char *parent) /* it was a directory */ continue; } - if (stat(fullname, &st)) { - IODEBUG mnstr_printf(GDKstdout,"BBPdiskscan: stat(%s)", fullname); - continue; - } - IODEBUG THRprintf(GDKstdout, "#BBPdiskscan: stat(%s) = 0\n", fullname); if (ok == FALSE || !persistent_bat(bid)) { delete = TRUE; @@ -3710,7 +3696,7 @@ BBPdiskscan(const char *parent) break; } if (delete) { - if (unlink(fullname) < 0) { + if (unlink(fullname) < 0 && errno != ENOENT) { GDKsyserror("BBPdiskscan: unlink(%s)", fullname); continue; } diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c --- a/gdk/gdk_heap.c +++ b/gdk/gdk_heap.c @@ -651,15 +651,15 @@ HEAPload_intern(Heap *h, const char *nme GDKfilepath(dstpath, BATDIR, nme, ext); assert(strlen(srcpath) + strlen(suffix) < sizeof(srcpath)); strcat(srcpath, suffix); - ret = stat(dstpath, &st); if (stat(srcpath, &st) == 0) { int t0; - if (ret == 0) { - t0 = GDKms(); - ret = unlink(dstpath); - HEAPDEBUG fprintf(stderr, "#unlink %s = %d (%dms)\n", dstpath, ret, GDKms() - t0); - } t0 = GDKms(); + ret = unlink(dstpath); + if (ret < 0 && errno == ENOENT) + ret = 0; /* no error if it doesn't exist */ + HEAPDEBUG fprintf(stderr, "#unlink %s = %d (%dms)\n", dstpath, ret, GDKms() - t0); + t0 = GDKms(); + /* coverity[toctou] */ ret = rename(srcpath, dstpath); if (ret < 0) { GDKsyserror("HEAPload: rename of %s failed\n", srcpath); diff --git a/gdk/gdk_storage.c b/gdk/gdk_storage.c --- a/gdk/gdk_storage.c +++ b/gdk/gdk_storage.c @@ -686,14 +686,20 @@ BATload_intern(bat i, int lock) } if (b->batCapacity != (b->T->heap.size >> b->T->shift)) { BUN cap = b->batCapacity; + int h; if (cap < (b->T->heap.size >> b->T->shift)) { cap = (BUN) (b->T->heap.size >> b->T->shift); HEAPDEBUG fprintf(stderr, "#HEAPextend in BATload_inter %s " SZFMT " " SZFMT "\n", b->H->heap.filename, b->H->heap.size, headsize(b, cap)); - HEAPextend(&b->H->heap, headsize(b, cap), b->batRestricted == BAT_READ); + h = HEAPextend(&b->H->heap, headsize(b, cap), b->batRestricted == BAT_READ); b->batCapacity = cap; } else { HEAPDEBUG fprintf(stderr, "#HEAPextend in BATload_intern %s " SZFMT " " SZFMT "\n", b->T->heap.filename, b->T->heap.size, tailsize(b, cap)); - HEAPextend(&b->T->heap, tailsize(b, cap), b->batRestricted == BAT_READ); + h = HEAPextend(&b->T->heap, tailsize(b, cap), b->batRestricted == BAT_READ); + } + if (h < 0) { + HEAPfree(&b->H->heap); + HEAPfree(&b->T->heap); + return NULL; } } } else { diff --git a/monetdb5/mal/Tests/tst013.stable.out b/monetdb5/mal/Tests/tst013.stable.out --- a/monetdb5/mal/Tests/tst013.stable.out +++ b/monetdb5/mal/Tests/tst013.stable.out @@ -34,7 +34,7 @@ stdout of test 'tst013` in directory 'mo function user.main():void; # incomplete barrier blocks. Resolve them when unambigous barrier z := true; - leave X_4; + leave ; exit z; barrier i := 1; i := calc.+(i,1); diff --git a/monetdb5/mal/Tests/tst036.stable.out b/monetdb5/mal/Tests/tst036.stable.out --- a/monetdb5/mal/Tests/tst036.stable.out +++ b/monetdb5/mal/Tests/tst036.stable.out @@ -16,8 +16,6 @@ stdout of test 'tst036` in directory 'mo # MonetDB/SQL module v2.39.0 loaded # MonetDB/GIS module v0.19.0 loaded !TypeException:user.main[6]:Multiple assignment mismatch -!TypeException:user.main[7]:Multiple assignment mismatch -!TypeException:user.main[8]:Multiple assignment mismatch function user.main():void; # test for proper use of list assignments (z0,z1) := (1,"help"); diff --git a/monetdb5/mal/Tests/tst050.stable.out b/monetdb5/mal/Tests/tst050.stable.out --- a/monetdb5/mal/Tests/tst050.stable.out +++ b/monetdb5/mal/Tests/tst050.stable.out @@ -28,10 +28,6 @@ stdout of test 'tst050` in directory 'mo #f:flt := "wrong"; # !TypeException:user.main[9]:type mismatch sht := lng - -!TypeException:user.main[10]:type mismatch lng := sht -!TypeException:user.main[11]:'bat.new' undefined in: y:bat[:oid,:str] := bat.new(_11:oid, _12:int) -!TypeException:user.main[12]:type mismatch flt := str function user.main():void; # Variables names may be tagged with a type upfront. # They may be initialized with a lexical constant using diff --git a/monetdb5/mal/Tests/tst070.stable.out b/monetdb5/mal/Tests/tst070.stable.out --- a/monetdb5/mal/Tests/tst070.stable.out +++ b/monetdb5/mal/Tests/tst070.stable.out @@ -12,7 +12,6 @@ stdout of test 'tst070` in directory 'mo # Visit http://monetdb.cwi.nl/ for further information # Listening for connection requests on mapi:monetdb://eir.ins.cwi.nl:33085/ !TypeException:user.foo[1]:'user.point' undefined in: (x:any, y:any) := user.point(_3:int) -!TypeException:user.foo[2]:'user.getName' undefined in: (initial:str, surname:str) := user.getName() function user.foo():void; (x,y) := user.point(1); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list