Changeset: 73454c94db30 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/73454c94db30 Branch: default Log Message:
merged with Jun2023 diffs (truncated from 703 to 300 lines): diff --git a/cmake/monetdb-toolchain.cmake b/cmake/monetdb-toolchain.cmake --- a/cmake/monetdb-toolchain.cmake +++ b/cmake/monetdb-toolchain.cmake @@ -27,6 +27,15 @@ function(monetdb_default_compiler_option else() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" PARENT_SCOPE) endif() + elseif ("${CMAKE_C_COMPILER_ID}" MATCHES "^(Clang|AppleClang)$") + add_compile_options("-fsanitize=address") + add_compile_options("-fno-omit-frame-pointer") + add_compile_definitions(SANITIZER) + if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0") + add_link_options("-fsanitize=address") + else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address" PARENT_SCOPE) + endif() else() message(FATAL_ERROR "Sanitizer only supported with GCC") endif() diff --git a/gdk/gdk_strimps.c b/gdk/gdk_strimps.c --- a/gdk/gdk_strimps.c +++ b/gdk/gdk_strimps.c @@ -141,7 +141,7 @@ histogram_index(PairHistogramElem *hist, inline static bool pair_at(PairIterator *pi, CharPair *p) { - if (pi->pos >= pi->lim) + if (pi->pos >= pi->lim - 1) return false; p->pbytes = (uint8_t*)pi->s + pi->pos; p->psize = 2; @@ -151,7 +151,7 @@ pair_at(PairIterator *pi, CharPair *p) inline static bool next_pair(PairIterator *pi) { - if (pi->pos >= pi->lim) + if (pi->pos >= pi->lim - 1) return false; pi->pos++; return true; @@ -688,14 +688,7 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s) if ((r = b->tstrimps) == NULL && STRMPbuildHeader(b, s, hpairs)) { /* Find the header pairs, put the result in hpairs */ - /* The 64th bit in the bit string is used to indicate if - the string is NULL. So the corresponding pair does - not encode useful information. We need to keep it for - alignment but we must make sure that it will not - match an actual pair of characters we encounter in - strings.*/ - for (i = 0; i < hpairs[STRIMP_HEADER_SIZE - 1].psize; i++) - hpairs[STRIMP_HEADER_SIZE - 1].pbytes[i] = 0; + sz = 8 + STRIMP_HEADER_SIZE; /* add 8-bytes for the descriptor and the pair sizes */ for (i = 0; i < STRIMP_HEADER_SIZE; i++) { @@ -725,12 +718,25 @@ STRMPcreateStrimpHeap(BAT *b, BAT *s) r->sizes_base = h1 = (uint8_t *)r->strimps.base + 8; r->pairs_base = h2 = (uint8_t *)h1 + STRIMP_HEADER_SIZE; - for (i = 0; i < STRIMP_HEADER_SIZE; i++) { + for (i = 0; i < STRIMP_HEADER_SIZE - 1; i++) { uint8_t psize = hpairs[i].psize; h1[i] = psize; memcpy(h2, hpairs[i].pbytes, psize); h2 += psize; } + + /* The 64th bit in the bit string is used to indicate if + the string is NULL. So the corresponding pair does + not encode useful information. We need to keep it for + alignment but we must make sure that it will not + match an actual pair of characters we encounter in + strings.*/ + h1[STRIMP_HEADER_SIZE - 1] = hpairs[STRIMP_HEADER_SIZE - 1].psize; + for(i = 0; i < hpairs[STRIMP_HEADER_SIZE - 1].psize; i++) { + *(h2 + i) = 0; + } + h2 += hpairs[STRIMP_HEADER_SIZE - 1].psize; + r->bitstrings_base = h2; r->strimps.free = sz; r->rec_cnt = 0; diff --git a/monetdb5/mal/mal_embedded.c b/monetdb5/mal/mal_embedded.c --- a/monetdb5/mal/mal_embedded.c +++ b/monetdb5/mal/mal_embedded.c @@ -69,7 +69,7 @@ malEmbeddedBoot(int workerlimit, int mem "unable to open vault_key_file %s: %s\n", GDKgetenv("monet_vault_key"), strerror(errno)); } - len = fread(secret, 1, sizeof(secret), secretf); + len = fread(secret, 1, sizeof(secret) - 1, secretf); fclose(secretf); secret[len] = '\0'; len = strlen(secret); /* secret can contain null-bytes */ diff --git a/sql/ChangeLog.Sep2022 b/sql/ChangeLog.Sep2022 --- a/sql/ChangeLog.Sep2022 +++ b/sql/ChangeLog.Sep2022 @@ -1,3 +1,9 @@ # ChangeLog file for sql # This file is updated with Maddlog +* Fri Jun 9 2023 Sjoerd Mullender <sjo...@acm.org> +- An upgrade that both creates a new .snapshot user and extends the + sys.db_user_info table with (among others) a password column did + these in such a way that the passord value for the new user was NULL. + This is fixed by updating the password. + diff --git a/sql/backends/monet5/sql_user.c b/sql/backends/monet5/sql_user.c --- a/sql/backends/monet5/sql_user.c +++ b/sql/backends/monet5/sql_user.c @@ -329,18 +329,17 @@ monet5_create_user(ptr _mvc, str user, s pwd = passwd; } - if ((err = AUTHGeneratePasswordHash(&hash, pwd)) != MAL_SUCCEED) { + err = AUTHGeneratePasswordHash(&hash, pwd); + if (!enc) + free(pwd); + if (err != MAL_SUCCEED) { GDKfree(schema_buf); - if (!enc) - free(pwd); throw(MAL, "sql.create_user", SQLSTATE(42000) "create backend hash failure"); } user_id = store_next_oid(m->session->tr->store); sqlid default_role_id = role_id > 0 ? role_id : user_id; if ((log_res = store->table_api.table_insert(m->session->tr, db_user_info, &user, &fullname, &schema_id, &schema_path, &max_memory, &max_workers, &optimizer, &default_role_id, &hash))) { - if (!enc) - free(pwd); GDKfree(schema_buf); GDKfree(hash); throw(SQL, "sql.create_user", SQLSTATE(42000) "Create user failed%s", log_res == LOG_CONFLICT ? " due to conflict with another transaction" : ""); @@ -350,8 +349,6 @@ monet5_create_user(ptr _mvc, str user, s GDKfree(hash); if ((log_res = store->table_api.table_insert(m->session->tr, auths, &user_id, &user, &grantorid))) { - if (!enc) - free(pwd); throw(SQL, "sql.create_user", SQLSTATE(42000) "Create user failed%s", log_res == LOG_CONFLICT ? " due to conflict with another transaction" : ""); } @@ -359,21 +356,15 @@ monet5_create_user(ptr _mvc, str user, s // update schema authorization to be default_role_id switch (sql_trans_change_schema_authorization(m->session->tr, schema_id, default_role_id)) { case -1: - if (!enc) - free(pwd); throw(SQL,"sql.create_user",SQLSTATE(HY013) MAL_MALLOC_FAIL); case -2: case -3: - if (!enc) - free(pwd); throw(SQL,"sql.create_user",SQLSTATE(42000) "Update schema authorization failed due to transaction conflict"); default: break; } } - if (!enc) - free(pwd); return ret; } diff --git a/sql/storage/store.c b/sql/storage/store.c --- a/sql/storage/store.c +++ b/sql/storage/store.c @@ -2654,6 +2654,12 @@ hot_snapshot_write_tar(stream *out, cons char *dest_name = dest_path + snprintf(dest_path, sizeof(dest_path), "%s/", prefix); stream *infile = NULL; + lng timeoffset = 0; + QryCtx *qry_ctx = MT_thread_get_qry_ctx(); + if (qry_ctx != NULL) { + timeoffset = (qry_ctx->starttime && qry_ctx->querytimeout) ? (qry_ctx->starttime + qry_ctx->querytimeout) : 0; + } + int len; if (sscanf(p, "%[^\n]\n%n", abs_src_path, &len) != 1) { GDKerror("internal error: first line of plan is malformed"); @@ -2666,6 +2672,7 @@ hot_snapshot_write_tar(stream *out, cons char command; long size; while (sscanf(p, "%c %ld %100s\n%n", &command, &size, src_name, &len) == 3) { + GDK_CHECK_TIMEOUT_BODY(timeoffset, GOTO_LABEL_TIMEOUT_HANDLER(end)); p += len; strcpy(dest_name, src_name); if (size < 0) { diff --git a/sql/test/sys-schema/Tests/All b/sql/test/sys-schema/Tests/All --- a/sql/test/sys-schema/Tests/All +++ b/sql/test/sys-schema/Tests/All @@ -15,6 +15,7 @@ webExamplesLogicalFunctionsOperators webExamplesComparisonFunctionsOperators webExamplesCastFunctionsOperators webExamplesMathematicalFunctionsOperators +webExamplesDateTimeFunctionsOperators webExamplesUrlFunctions utilities diff --git a/sql/test/sys-schema/Tests/webExamplesDateTimeFunctionsOperators.test b/sql/test/sys-schema/Tests/webExamplesDateTimeFunctionsOperators.test new file mode 100644 --- /dev/null +++ b/sql/test/sys-schema/Tests/webExamplesDateTimeFunctionsOperators.test @@ -0,0 +1,498 @@ +statement ok +SET TIME ZONE interval '+02:00' hour to minute + +# Date/Time literal formats +query T +select date '2020-09-28' +---- +2020-09-28 + +query T +select {d '2020-09-28'} +---- +2020-09-28 + +# next query fails in Mtest.py with error: too many values to unpack (expected 3). It does not fail when used in mclient or via JDBC driver, so possibly an issue with Mtest.py +#query T +#select date '-4712-01-01' +#---- +#-4712-01-01 + +query T +select time '18:40:05' +---- +18:40:05 + +query T +select {t '18:40:05'} +---- +18:40:05 + +query T +select time(6) '18:40:05.123456' +---- +18:40:05.123456 + +query T +select time(3) with time zone '18:40:05.123+02:00' +---- +18:40:05.123000+02:00 + +query T +select timestamp '2020-09-28 18:40:05' +---- +2020-09-28 18:40:05 + +query T +select {ts '2020-09-28 18:40:05'} +---- +2020-09-28 18:40:05 + +query T +select timestamp(6) '2020-09-28 18:40:05.123456' +---- +2020-09-28 18:40:05.123456 + +query T +select timestamp(3) with time zone '2020-09-28 18:40:05.123+02:00' +---- +2020-09-28 18:40:05.123000+02:00 + +query T +select interval '86399' second +---- +23:59:59 + +query T +select {interval '86399' second} +---- +23:59:59 + +query T +select interval '30' day +---- +30 + +query T +select {interval '30' day} +---- +30 + +query T +select interval '6' month +---- +6 + +query T +select {interval '6' month} +---- +6 + +query T +select interval '18:40:05' hour to second +---- +18:40:05 + _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org