Changeset: d086133190d6 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/d086133190d6 Modified Files: clients/Tests/exports.stable.out gdk/gdk_batop.c monetdb5/mal/mal_client.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_session.c monetdb5/optimizer/opt_prelude.c monetdb5/optimizer/opt_prelude.h monetdb5/optimizer/opt_remap.c monetdb5/optimizer/opt_support.h sql/backends/monet5/sql.c Branch: resource_management Log Message:
merge with default diffs (truncated from 1710 to 300 lines): diff --git a/ChangeLog.Dec2023 b/ChangeLog.Dec2023 --- a/ChangeLog.Dec2023 +++ b/ChangeLog.Dec2023 @@ -1,3 +1,7 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Tue Aug 6 2024 Sjoerd Mullender <sjo...@acm.org> +- The CMake configuration files for building extensions have now been + included in the various MonetDB development RPMs and debs. + diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -211,6 +211,12 @@ functionality of MonetDB. %{_includedir}/monetdb/monet*.h %{_libdir}/libbat*.so %{_libdir}/pkgconfig/monetdb-gdk.pc +%dir %{_datadir}/monetdb +%dir %{_datadir}/monetdb/cmake +%{_datadir}/monetdb/cmake/gdkTargets*.cmake +%{_datadir}/monetdb/cmake/matomicTargets.cmake +%{_datadir}/monetdb/cmake/mstringTargets.cmake +%{_datadir}/monetdb/cmake/monetdb_config_headerTargets.cmake %endif %package stream @@ -258,6 +264,7 @@ library. %{_includedir}/monetdb/stream.h %{_includedir}/monetdb/stream_socket.h %{_libdir}/pkgconfig/monetdb-stream.pc +%{_datadir}/monetdb/cmake/streamTargets*.cmake %endif %package client-lib @@ -338,6 +345,7 @@ This package contains the files needed t %{_includedir}/monetdb/mapi*.h %{_includedir}/monetdb/msettings.h %{_libdir}/pkgconfig/monetdb-mapi.pc +%{_datadir}/monetdb/cmake/mapiTargets*.cmake %endif %if %{without compat} @@ -644,6 +652,7 @@ used from the MAL level. %{_includedir}/monetdb/mel.h %{_libdir}/libmonetdb5*.so %{_libdir}/pkgconfig/monetdb5.pc +%{_datadir}/monetdb/cmake/monetdb5Targets*.cmake %endif %package SQL @@ -701,6 +710,7 @@ Summary: MonetDB SQL server modules deve Group: Applications/Databases Requires: %{name}-SQL%{?_isa} = %{version}-%{release} Requires: %{name}-server-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-embedded-devel%{?_isa} = %{version}-%{release} %description SQL-devel MonetDB is a database management system that is developed from a @@ -716,6 +726,8 @@ This package contains files needed to de %{_includedir}/monetdb/rel_*.h %{_includedir}/monetdb/sql*.h %{_includedir}/monetdb/store_*.h +%{_datadir}/monetdb/cmake/MonetDBConfig*.cmake +%{_datadir}/monetdb/cmake/sqlTargets*.cmake %endif %if %{without compat} @@ -759,6 +771,7 @@ program that uses MonetDB as an embeddab %{_libdir}/libmonetdbe.so %{_includedir}/monetdb/monetdbe.h %{_libdir}/pkgconfig/monetdbe.pc +%{_datadir}/monetdb/cmake/monetdbeTargets*.cmake %package embedded-tests Summary: MonetDBe tests package @@ -938,7 +951,6 @@ rm -f "${RPM_BUILD_ROOT}"%{_libdir}/mone rm -f "${RPM_BUILD_ROOT}"%{_libdir}/monetdb5*/lib_microbenchmark*.so rm -f "${RPM_BUILD_ROOT}"%{_libdir}/monetdb5*/lib_udf*.so rm -f "${RPM_BUILD_ROOT}"%{_bindir}/monetdb_mtest.sh -rm -rf "${RPM_BUILD_ROOT}"%{_datadir}/monetdb # /cmake if [ -x /usr/sbin/hardlink ]; then /usr/sbin/hardlink -cv "${RPM_BUILD_ROOT}"%{_datadir}/selinux 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 @@ -1325,6 +1325,7 @@ void trimMalVariables(MalBlkPtr mb, MalS void trimMalVariables_(MalBlkPtr mb, MalStkPtr glb); void typeChecker(Module scope, MalBlkPtr mb, InstrPtr p, int p_idx, int silent); const char *umaskRef; +const char *unionfuncRef; const char *uniqueRef; const char *unlockRef; const char *updateRef; diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -2251,14 +2251,10 @@ dump_table(Mapi mid, const char *schema, goto doreturn; } for (int64_t i = 0; i < rows; i++) { - if (mapi_fetch_row(hdl) == 0) { - mapi_close_handle(hdl); - fprintf(stderr, "unexepcted error\n"); - goto doreturn; - } - tables[i].schema = strdup(mapi_fetch_field(hdl, 0)); - tables[i].table = strdup(mapi_fetch_field(hdl, 1)); - if (tables[i].schema == NULL || tables[i].table == NULL) { + tables[i].schema = tables[i].table = NULL; + if (mapi_fetch_row(hdl) == 0 || + (tables[i].schema = strdup(mapi_fetch_field(hdl, 0))) == NULL || + (tables[i].table = strdup(mapi_fetch_field(hdl, 1))) == NULL) { do { free(tables[i].schema); free(tables[i].table); diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -1786,12 +1786,6 @@ mapi_new(msettings *settings) mid = malloc(sizeof(*mid)); if (mid == NULL) return NULL; - if (settings == NULL) - settings = msettings_create(); - if (settings == NULL) { - free(mid); - return NULL; - } /* then fill in some details */ *mid = MapiStructDefaults; @@ -1800,6 +1794,13 @@ mapi_new(msettings *settings) mapi_destroy(mid); return NULL; } + if (settings == NULL) { + settings = msettings_create(); + if (settings == NULL) { + mapi_destroy(mid); + return NULL; + } + } mid->settings = settings; mid->blk.buf[0] = 0; mid->blk.buf[mid->blk.lim] = 0; diff --git a/cmake/monetdb-defines.cmake b/cmake/monetdb-defines.cmake --- a/cmake/monetdb-defines.cmake +++ b/cmake/monetdb-defines.cmake @@ -84,6 +84,7 @@ function(monetdb_configure_defines) check_function_exists("getuid" HAVE_GETUID) check_symbol_exists("gmtime_r" "time.h" HAVE_GMTIME_R) check_symbol_exists("localtime_r" "time.h" HAVE_LOCALTIME_R) + check_symbol_exists("strerror_s" "string.h" HAVE_STRERROR_S) check_symbol_exists("strerror_r" "string.h" HAVE_STRERROR_R) check_function_exists("lockf" HAVE_LOCKF) check_symbol_exists("madvise" "sys/mman.h" HAVE_MADVISE) @@ -100,6 +101,7 @@ function(monetdb_configure_defines) check_symbol_exists("posix_fallocate" "fcntl.h" HAVE_POSIX_FALLOCATE) check_symbol_exists("posix_madvise" "sys/mman.h" HAVE_POSIX_MADVISE) check_function_exists("setsid" HAVE_SETSID) + check_function_exists("sockatmark" HAVE_SOCKATMARK) check_function_exists("shutdown" HAVE_SHUTDOWN) check_function_exists("sigaction" HAVE_SIGACTION) check_function_exists("siglongjmp" HAVE_SIGLONGJMP) diff --git a/common/stream/fwf.c b/common/stream/fwf.c --- a/common/stream/fwf.c +++ b/common/stream/fwf.c @@ -47,8 +47,10 @@ stream_fwf_read(stream *restrict s, void if (fsd == NULL || elmsize != 1) { return -1; } - if (fsd->eof) + if (fsd->eof) { + s->eof = 1; return 0; + } while (to_write > 0) { /* input conversion */ @@ -59,14 +61,18 @@ stream_fwf_read(stream *restrict s, void if (actually_read < 0) { return actually_read; /* this is an error */ } - fsd->eof |= fsd->s->eof; - return (ssize_t) buf_written; /* skip last line */ + if (actually_read == 0) { + fsd->eof |= fsd->s->eof; + s->eof = fsd->eof; + return (ssize_t) buf_written; /* skip last line */ + } } /* consume to next newline */ while (fsd->s->read(fsd->s, &nl_buf, 1, 1) == 1 && nl_buf != '\n') ; fsd->eof |= fsd->s->eof; + s->eof = fsd->eof; for (field_idx = 0; field_idx < fsd->num_fields; field_idx++) { char *val_start, *val_end; diff --git a/common/stream/socket_stream.c b/common/stream/socket_stream.c --- a/common/stream/socket_stream.c +++ b/common/stream/socket_stream.c @@ -73,10 +73,17 @@ socket_getoob(const stream *s) for (;;) { int atmark = 0; char flush[100]; +#ifdef HAVE_SOCKATMARK + if ((atmark = sockatmark(fd)) < 0) { + perror("sockatmark"); + break; + } +#else if (ioctlsocket(fd, SIOCATMARK, &atmark) < 0) { perror("ioctl"); break; } +#endif if (atmark) break; if (recv(fd, flush, sizeof(flush), 0) < 0) { @@ -306,10 +313,17 @@ socket_read(stream *restrict s, void *re for (;;) { int atmark = 0; char flush[100]; +#ifdef HAVE_SOCKATMARK + if ((atmark = sockatmark(s->stream_data.s)) < 0) { + perror("sockatmark"); + break; + } +#else if (ioctlsocket(s->stream_data.s, SIOCATMARK, &atmark) < 0) { perror("ioctl"); break; } +#endif if (atmark) break; if (recv(s->stream_data.s, flush, sizeof(flush), 0) < 0) { @@ -362,10 +376,17 @@ socket_read(stream *restrict s, void *re for (;;) { int atmark = 0; char flush[100]; +#ifdef HAVE_SOCKATMARK + if ((atmark = sockatmark(s->stream_data.s)) < 0) { + perror("sockatmark"); + break; + } +#else if (ioctlsocket(s->stream_data.s, SIOCATMARK, &atmark) < 0) { perror("ioctl"); break; } +#endif if (atmark) break; if (recv(s->stream_data.s, flush, sizeof(flush), 0) < 0) { diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -426,24 +426,32 @@ mnstr_set_open_error(const char *name, i static size_t my_strerror_r(int error_nr, char *buf, size_t buflen) { - // Three cases: - // 1. no strerror_r + // Four cases: + // 1. strerror_s // 2. gnu strerror_r (returns char* and does not always fill buffer) // 3. xsi strerror_r (returns int and always fills the buffer) + // 4. no strerror_r and no strerror_s char *to_move; -#ifndef HAVE_STRERROR_R - // Hope for the best - to_move = strerror(error_nr); -#elif !defined(_GNU_SOURCE) || !_GNU_SOURCE - // standard strerror_r always writes to buf +#ifdef HAVE_STRERROR_S + int result_code = strerror_s(buf, buflen, error_nr); + if (result_code == 0) + to_move = NULL; + else + to_move = "<failed to retrieve error message>"; +#elif defined(HAVE_STRERROR_R) +#ifdef STRERROR_R_CHARP + // gnu strerror_r sometimes only returns static string, needs copy + to_move = strerror_r(error_nr, buf, buflen); +#else int result_code = strerror_r(error_nr, buf, buflen); if (result_code == 0) to_move = NULL; else to_move = "<failed to retrieve error message>"; +#endif #else - // gnu strerror_r sometimes only returns static string, needs copy - to_move = strerror_r(error_nr, buf, buflen); + // Hope for the best _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org