Changeset: e932da68b494 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e932da68b494
Modified Files:
        clients/Tests/MAL-signatures.test
        sql/test/miscellaneous/Tests/simple_selects.test
        sql/test/sys-schema/Tests/systemfunctions.test
Branch: mtest
Log Message:

Merged with default


diffs (truncated from 34588 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -161,16 +161,13 @@ BuildRequires: pkgconfig(libR)
 BuildRequires: texlive-obsolete
 %endif
 %endif
-# if we were to compile with cmocka support (-DWITH_CMOCKA=ON):
-# BuildRequires: pkgconfig(cmocka)
-# if we were to compile with NetCDF support (-DNETCDF=ON):
-# BuildRequires: pkgconfig(netcdf)
-# if we were to compile with proj support (-DWITH_PROJ=ON):
-# BuildRequires: pkgconfig(proj)
-# if we were to compile with snappy support (-DWITH_SNAPPY=ON):
-# BuildRequires: pkgconfig(snappy)
-# if we were to compile with valgrind support (-DWITH_VALGRIND=ON):
-# BuildRequires: pkgconfig(valgrind)
+# optional packages:
+# BuildRequires: pkgconfig(cmocka)     # -DWITH_CMOCKA=ON
+# BuildRequires: pkgconfig(gdal)       # -DSHP=ON
+# BuildRequires: pkgconfig(netcdf)     # -DNETCDF=ON
+# BuildRequires: pkgconfig(proj)       # -DWITH_PROJ=ON
+# BuildRequires: pkgconfig(snappy)     # -DWITH_SNAPPY=ON
+# BuildRequires: pkgconfig(valgrind)   # -DWITH_VALGRIND=ON
 
 %if (0%{?fedora} >= 22)
 Recommends: %{name}-SQL-server5%{?_isa} = %{version}-%{release}
diff --git a/clients/Tests/MAL-signatures.stable.out 
b/clients/Tests/MAL-signatures.stable.out
--- a/clients/Tests/MAL-signatures.stable.out
+++ b/clients/Tests/MAL-signatures.stable.out
@@ -6259,6 +6259,8 @@ stdout of test 'MAL-signatures` in direc
 [ "batmtime",  "timestamp_to_str",     "pattern 
batmtime.timestamp_to_str(X_1:timestamp, X_2:bat[:str], 
X_3:bat[:oid]):bat[:str] ",    "MTIMEtimestamp_to_str_bulk_p1;",       ""      ]
 [ "batmtime",  "timestamp_to_str",     "pattern 
batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str):bat[:str] ",   
"MTIMEtimestamp_to_str_bulk_p2;",       ""      ]
 [ "batmtime",  "timestamp_to_str",     "pattern 
batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str, 
X_3:bat[:oid]):bat[:str] ",    "MTIMEtimestamp_to_str_bulk_p2;",       ""      ]
+[ "batmtime",  "usweekofyear", "pattern 
batmtime.usweekofyear(X_1:bat[:date]):bat[:int] ",     
"MTIMEdate_extract_usweekofyear_bulk;", ""      ]
+[ "batmtime",  "usweekofyear", "pattern batmtime.usweekofyear(X_1:bat[:date], 
X_2:bat[:oid]):bat[:int] ",      "MTIMEdate_extract_usweekofyear_bulk;", ""     
 ]
 [ "batmtime",  "weekofyear",   "pattern 
batmtime.weekofyear(X_1:bat[:date]):bat[:int] ",       
"MTIMEdate_extract_weekofyear_bulk;",   ""      ]
 [ "batmtime",  "weekofyear",   "pattern batmtime.weekofyear(X_1:bat[:date], 
X_2:bat[:oid]):bat[:int] ",        "MTIMEdate_extract_weekofyear_bulk;",   ""   
   ]
 [ "batmtime",  "year", "pattern batmtime.year(X_1:bat[:date]):bat[:int] ",     
"MTIMEdate_extract_year_bulk;", ""      ]
@@ -9089,6 +9091,7 @@ stdout of test 'MAL-signatures` in direc
 [ "mtime",     "timestamp_sub_month_interval", "command 
mtime.timestamp_sub_month_interval(X_1:timestamp, X_2:int):timestamp ",        
"MTIMEtimestamp_sub_month_interval;",   ""      ]
 [ "mtime",     "timestamp_sub_msec_interval",  "command 
mtime.timestamp_sub_msec_interval(X_1:timestamp, X_2:lng):timestamp ", 
"MTIMEtimestamp_sub_msec_interval;",    ""      ]
 [ "mtime",     "timestamp_to_str",     "command 
mtime.timestamp_to_str(X_1:timestamp, X_2:str):str ",  
"MTIMEtimestamp_to_str;",       ""      ]
+[ "mtime",     "usweekofyear", "command mtime.usweekofyear(X_1:date):int ",    
"MTIMEdate_extract_usweekofyear;",      ""      ]
 [ "mtime",     "weekofyear",   "command mtime.weekofyear(X_1:date):int ",      
"MTIMEdate_extract_weekofyear;",        ""      ]
 [ "mtime",     "year", "command mtime.year(X_1:date):int ",    
"MTIMEdate_extract_year;",      ""      ]
 [ "mtime",     "year", "command mtime.year(X_1:int):int ",     
"MTIMEsql_year;",       ""      ]
diff --git a/clients/Tests/MAL-signatures.stable.out.int128 
b/clients/Tests/MAL-signatures.stable.out.int128
--- a/clients/Tests/MAL-signatures.stable.out.int128
+++ b/clients/Tests/MAL-signatures.stable.out.int128
@@ -8789,6 +8789,8 @@ stdout of test 'MAL-signatures` in direc
 [ "batmtime",  "timestamp_to_str",     "pattern 
batmtime.timestamp_to_str(X_1:timestamp, X_2:bat[:str], 
X_3:bat[:oid]):bat[:str] ",    "MTIMEtimestamp_to_str_bulk_p1;",       ""      ]
 [ "batmtime",  "timestamp_to_str",     "pattern 
batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str):bat[:str] ",   
"MTIMEtimestamp_to_str_bulk_p2;",       ""      ]
 [ "batmtime",  "timestamp_to_str",     "pattern 
batmtime.timestamp_to_str(X_1:bat[:timestamp], X_2:str, 
X_3:bat[:oid]):bat[:str] ",    "MTIMEtimestamp_to_str_bulk_p2;",       ""      ]
+[ "batmtime",  "usweekofyear", "pattern 
batmtime.usweekofyear(X_1:bat[:date]):bat[:int] ",     
"MTIMEdate_extract_usweekofyear_bulk;", ""      ]
+[ "batmtime",  "usweekofyear", "pattern batmtime.usweekofyear(X_1:bat[:date], 
X_2:bat[:oid]):bat[:int] ",      "MTIMEdate_extract_usweekofyear_bulk;", ""     
 ]
 [ "batmtime",  "weekofyear",   "pattern 
batmtime.weekofyear(X_1:bat[:date]):bat[:int] ",       
"MTIMEdate_extract_weekofyear_bulk;",   ""      ]
 [ "batmtime",  "weekofyear",   "pattern batmtime.weekofyear(X_1:bat[:date], 
X_2:bat[:oid]):bat[:int] ",        "MTIMEdate_extract_weekofyear_bulk;",   ""   
   ]
 [ "batmtime",  "year", "pattern batmtime.year(X_1:bat[:date]):bat[:int] ",     
"MTIMEdate_extract_year_bulk;", ""      ]
@@ -12391,6 +12393,7 @@ stdout of test 'MAL-signatures` in direc
 [ "mtime",     "timestamp_sub_month_interval", "command 
mtime.timestamp_sub_month_interval(X_1:timestamp, X_2:int):timestamp ",        
"MTIMEtimestamp_sub_month_interval;",   ""      ]
 [ "mtime",     "timestamp_sub_msec_interval",  "command 
mtime.timestamp_sub_msec_interval(X_1:timestamp, X_2:lng):timestamp ", 
"MTIMEtimestamp_sub_msec_interval;",    ""      ]
 [ "mtime",     "timestamp_to_str",     "command 
mtime.timestamp_to_str(X_1:timestamp, X_2:str):str ",  
"MTIMEtimestamp_to_str;",       ""      ]
+[ "mtime",     "usweekofyear", "command mtime.usweekofyear(X_1:date):int ",    
"MTIMEdate_extract_usweekofyear;",      ""      ]
 [ "mtime",     "weekofyear",   "command mtime.weekofyear(X_1:date):int ",      
"MTIMEdate_extract_weekofyear;",        ""      ]
 [ "mtime",     "year", "command mtime.year(X_1:date):int ",    
"MTIMEdate_extract_year;",      ""      ]
 [ "mtime",     "year", "command mtime.year(X_1:int):int ",     
"MTIMEsql_year;",       ""      ]
diff --git a/clients/Tests/MAL-signatures.test 
b/clients/Tests/MAL-signatures.test
--- a/clients/Tests/MAL-signatures.test
+++ b/clients/Tests/MAL-signatures.test
@@ -1,6 +1,6 @@
 query TTTTT rowsort
 select * from sys.malfunctions() order by module, "function", address, 
signature, comment
 ----
-65490 values hashing to ca0241b9eab8bb582f3f93a7fd008dd8
+65520 values hashing to 3abd7dc63f82fc485bf8bfcf1b2af07e
 
 
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -461,6 +461,7 @@ ssize_t date_fromstr(const char *buf, si
 int date_month(date dt) __attribute__((__const__));
 int date_quarter(date dt) __attribute__((__const__));
 ssize_t date_tostr(str *buf, size_t *len, const date *val, bool external);
+int date_usweekofyear(date dt) __attribute__((__const__));
 int date_weekofyear(date dt) __attribute__((__const__));
 int date_year(date dt) __attribute__((__const__));
 daytime daytime_add_usec(daytime tm, lng usec) __attribute__((__const__));
diff --git a/clients/examples/C/streamcat.c b/clients/examples/C/streamcat.c
--- a/clients/examples/C/streamcat.c
+++ b/clients/examples/C/streamcat.c
@@ -207,6 +207,8 @@ int cmd_read(char *argv[])
 
        copy_stream_to_file(s, out, bufsize);
        close_stream(s);
+       if (out != stdout)
+               fclose(out);
 
        return 0;
 }
@@ -318,6 +320,9 @@ int cmd_write(char *argv[])
        copy_file_to_stream(in, s, bufsize, do_flush, flush_level);
        close_stream(s);
 
+       if (in != stdin)
+               fclose(in);
+
        return 0;
 }
 
@@ -557,13 +562,13 @@ int cmd_bstream(char *argv[])
                        fclose(f);
                        mnstr_flush(bs, MNSTR_FLUSH_DATA);
                }
-               mnstr_destroy(bs);
-               if (additional) {
-                       mnstr_printf(s, "%s", additional);
-               }
-               mnstr_close(s);
        }
 
+       mnstr_destroy(bs);
+       if (additional) {
+               mnstr_printf(s, "%s", additional);
+       }
+       mnstr_close(s);
 
        return 0;
 }
diff --git a/clients/mapiclient/ReadlineTools.c 
b/clients/mapiclient/ReadlineTools.c
--- a/clients/mapiclient/ReadlineTools.c
+++ b/clients/mapiclient/ReadlineTools.c
@@ -23,6 +23,12 @@
 #include <strings.h>           /* for strncasecmp */
 #endif
 
+#ifndef WIN32
+/* for umask */
+#include <sys/types.h>
+#include <sys/stat.h>
+#endif
+
 static const char *sql_commands[] = {
        "SELECT",
        "INSERT",
@@ -313,37 +319,40 @@ invoke_editor(int cnt, int key) {
        char *read_buff = NULL;
        char *editor = NULL;
        FILE *fp = NULL;
-       size_t content_len;
+       long content_len;
        size_t read_bytes, idx;
-#ifdef WIN32
-       char *mytemp;
-       char template[] = "mclient_temp_XXXXXX";
-#else
-       int mytemp;
-       char template[] = "/tmp/mclient_temp_XXXXXX";
-#endif
 
        (void) cnt;
        (void) key;
 
 #ifdef WIN32
+       char *mytemp;
+       char template[] = "mclient_temp_XXXXXX";
        if ((mytemp = _mktemp(template)) == NULL) {
-#else
-       if ((mytemp = mkstemp(template)) == 0) {
-#endif
                readline_show_error("invoke_editor: Cannot create temp file\n");
                goto bailout;
        }
-
-#ifdef WIN32
        if ((fp = fopen(mytemp, "r+")) == NULL) {
-#else
-       if ((fp = fdopen(mytemp, "r+")) == NULL) {
-#endif
                // Notify the user that we cannot create temp file
                readline_show_error("invoke_editor: Cannot create temp file\n");
                goto bailout;
        }
+#else
+       int mytemp;
+       char template[] = "/tmp/mclient_temp_XXXXXX";
+       mode_t msk = umask(077);
+       mytemp = mkstemp(template);
+       (void) umask(msk);
+       if (mytemp == -1) {
+               readline_show_error("invoke_editor: Cannot create temp file\n");
+               goto bailout;
+       }
+       if ((fp = fdopen(mytemp, "r+")) == NULL) {
+               // Notify the user that we cannot create temp file
+               readline_show_error("invoke_editor: Cannot create temp file\n");
+               goto bailout;
+       }
+#endif
 
        fwrite(rl_line_buffer, sizeof(char), rl_end, fp);
        fflush(fp);
@@ -368,24 +377,24 @@ invoke_editor(int cnt, int key) {
        rewind(fp);
 
        if (content_len > 0) {
-               read_buff = (char *)malloc(content_len*sizeof(char));
+               read_buff = (char *)malloc(content_len + 1);
                if (read_buff == NULL) {
                        readline_show_error("invoke_editor: Cannot allocate 
memory\n");
                        goto bailout;
                }
 
-               read_bytes = fread(read_buff, sizeof(char), content_len, fp);
-               if (read_bytes != content_len) {
+               read_bytes = fread(read_buff, sizeof(char), (size_t) 
content_len, fp);
+               if (read_bytes != (size_t) content_len) {
                        readline_show_error("invoke_editor: Did not read from 
file correctly\n");
                        goto bailout;
                }
 
-               *(read_buff + read_bytes) = 0;
+               read_buff[read_bytes] = 0;
 
                /* Remove trailing whitespace */
                idx = read_bytes - 1;
                while(isspace(*(read_buff + idx))) {
-                       *(read_buff + idx) = 0;
+                       read_buff[idx] = 0;
                        idx--;
                }
 
@@ -404,7 +413,8 @@ invoke_editor(int cnt, int key) {
        return 0;
 
 bailout:
-       fclose(fp);
+       if (fp)
+               fclose(fp);
        free(read_buff);
        unlink(template);
        return 1;
diff --git a/clients/mapiclient/msqldump.c b/clients/mapiclient/msqldump.c
--- a/clients/mapiclient/msqldump.c
+++ b/clients/mapiclient/msqldump.c
@@ -256,7 +256,9 @@ main(int argc, char **argv)
 
        mapi_destroy(mid);
        if (mnstr_errnr(out)) {
-               fprintf(stderr, "%s: %s\n", argv[0], mnstr_error(out));
+               char *err = mnstr_error(out);
+               fprintf(stderr, "%s: %s\n", argv[0], err);
+               free(err);
                return 1;
        }
 
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1546,7 +1546,9 @@ close_result(MapiHdl hdl)
                                if (mnstr_printf(mid->to, "%s", msg) < 0 ||
                                    mnstr_flush(mid->to, MNSTR_FLUSH_DATA)) {
                                        close_connection(mid);
-                                       mapi_setError(mid, 
mnstr_error(mid->to), __func__, MTIMEOUT);
+                                       char *err = mnstr_error(mid->to);
+                                       mapi_setError(mid, err, __func__, 
MTIMEOUT);
+                                       free(err);
                                        break;
                                }
                                read_into_cache(hdl, 0);
@@ -1564,7 +1566,9 @@ close_result(MapiHdl hdl)
                                if (mnstr_printf(mid->to, "%s", msg) < 0 ||
                                    mnstr_flush(mid->to, MNSTR_FLUSH_DATA)) {
                                        close_connection(mid);
-                                       mapi_setError(mid, 
mnstr_error(mid->to), __func__, MTIMEOUT);
+                                       char *err = mnstr_error(mid->to);
+                                       mapi_setError(mid, err, __func__, 
MTIMEOUT);
+                                       free(err);
                                } else
                                        read_into_cache(hdl, 0);
                        }
@@ -1788,7 +1792,9 @@ finish_handle(MapiHdl hdl)
                        if (mnstr_printf(mid->to, "%s", msg) < 0 ||
                            mnstr_flush(mid->to, MNSTR_FLUSH_DATA)) {
                                close_connection(mid);
-                               mapi_setError(mid, mnstr_error(mid->to), 
__func__, MTIMEOUT);
+                               char *err = mnstr_error(mid->to);
+                               mapi_setError(mid, err, __func__, MTIMEOUT);
+                               free(err);
                                break;
                        }
                        read_into_cache(hdl, 0);
@@ -2985,22 +2991,24 @@ mapi_resolve(const char *host, int port,
                return NULL;
 
        mid = mapi_mapi(host, port, "mero", "mero", "resolve", pattern);
-       if (mid && mid->error == MOK) {
-               rmax = mid->redirmax;
-               mid->redirmax = 0;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to