From 6c64b760a0d0fec825e98daecfb9b89b0466b08d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 3 Apr 2023 17:58:43 +0800 Subject: [PATCH 1/9] fix: fix tsim crash on windows due to invalid input to strftime --- source/common/src/tdatablock.c | 5 ++++- source/common/src/ttime.c | 20 ++++++++++++++++---- source/libs/function/src/builtins.c | 7 +++++-- source/libs/scalar/src/sclfunc.c | 12 ++++++++++-- utils/test/c/tmqSim.c | 5 ++++- utils/tsim/src/simExe.c | 5 ++++- 6 files changed, 43 insertions(+), 11 deletions(-) diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index 3c8d394b43..eeb2d4ff2e 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1864,7 +1864,10 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { } } struct tm ptm = {0}; - taosLocalTime(&tt, &ptm); + if (taosLocalTime(&tt, &ptm) == NULL) { + sprintf(buf, "NaN"); + return buf; + } size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); if (precision == TSDB_TIME_PRECISION_NANO) { diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 7996498d45..2f39cdeaa0 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -867,13 +867,19 @@ const char* fmtts(int64_t ts) { if (ts > -62135625943 && ts < 32503651200) { time_t t = (time_t)ts; - taosLocalTime(&t, &tm); + if (taosLocalTime(&t, &tm) == NULL) { + sprintf(buf, "NaN"); + return buf; + } pos += strftime(buf + pos, sizeof(buf), "s=%Y-%m-%d %H:%M:%S", &tm); } if (ts > -62135625943000 && ts < 32503651200000) { time_t t = (time_t)(ts / 1000); - taosLocalTime(&t, &tm); + if (taosLocalTime(&t, &tm) == NULL) { + sprintf(buf, "NaN"); + return buf; + } if (pos > 0) { buf[pos++] = ' '; buf[pos++] = '|'; @@ -885,7 +891,10 @@ const char* fmtts(int64_t ts) { { time_t t = (time_t)(ts / 1000000); - taosLocalTime(&t, &tm); + if (taosLocalTime(&t, &tm) == NULL) { + sprintf(buf, "NaN"); + return buf; + } if (pos > 0) { buf[pos++] = ' '; buf[pos++] = '|'; @@ -937,7 +946,10 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) ASSERT(false); } - taosLocalTime(", &ptm); + if (taosLocalTime(", &ptm) == NULL) { + sprintf(buf, "NaN"); + return; + } int32_t length = (int32_t)strftime(ts, 40, "%Y-%m-%dT%H:%M:%S", &ptm); length += snprintf(ts + length, fractionLen, format, mod); length += (int32_t)strftime(ts + length, 40 - length, "%z", &ptm); diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 0257b3d5e6..f78b8039a4 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -213,8 +213,11 @@ static int32_t addTimezoneParam(SNodeList* pList) { char buf[6] = {0}; time_t t = taosTime(NULL); struct tm tmInfo; - taosLocalTime(&t, &tmInfo); - strftime(buf, sizeof(buf), "%z", &tmInfo); + if (taosLocalTime(&t, &tmInfo) == NULL) { + sprintf(buf, "NaN"); + } else { + strftime(buf, sizeof(buf), "%z", &tmInfo); + } int32_t len = (int32_t)strlen(buf); SValueNode* pVal = (SValueNode*)nodesMakeNode(QUERY_NODE_VALUE); diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 195a08525c..7f19cb7831 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1067,9 +1067,16 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * } struct tm tmInfo; - taosLocalTime((const time_t *)&timeVal, &tmInfo); + int32_t len = 0; + + if (taosLocalTime((const time_t *)&timeVal, &tmInfo) == NULL) { + sprintf(buf, "NaN"); + len = (int32_t)strlen(buf); + goto _end; + } + strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", &tmInfo); - int32_t len = (int32_t)strlen(buf); + len = (int32_t)strlen(buf); // add timezone string if (tzLen > 0) { @@ -1103,6 +1110,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * len += fracLen; } +_end: memmove(buf + VARSTR_HEADER_SIZE, buf, len); varDataSetLen(buf, len); diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index 69debe7ab5..d81c70c65d 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -472,7 +472,10 @@ static char* shellFormatTimestamp(char* buf, int64_t val, int32_t precision) { } struct tm ptm; - taosLocalTime(&tt, &ptm); + if (taosLocalTime(&tt, &ptm) == NULL) { + sprintf(tt, "NaN"); + return buf; + } size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); if (precision == TSDB_TIME_PRECISION_NANO) { diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 9dd63d14a2..07b3648f3a 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -772,7 +772,10 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { tt = (*(int64_t *)row[i]) / 1000000000; } - taosLocalTime(&tt, &tp); + if (taosLocalTime(&tt, &tp) == NULL) { + sprintf(timeStr, "NaN"); + break; + } strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", &tp); if (precision == TSDB_TIME_PRECISION_MILLI) { sprintf(value, "%s.%03d", timeStr, (int32_t)(*((int64_t *)row[i]) % 1000)); From 8079532055525ffdc3509c9952cd9b7f6338954d Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 3 Apr 2023 17:58:43 +0800 Subject: [PATCH 2/9] fix: fix tsim crash on windows due to invalid input to strftime --- utils/test/c/tmqSim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index d81c70c65d..5eeb0aaa12 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -473,7 +473,7 @@ static char* shellFormatTimestamp(char* buf, int64_t val, int32_t precision) { struct tm ptm; if (taosLocalTime(&tt, &ptm) == NULL) { - sprintf(tt, "NaN"); + sprintf(buf, "NaN"); return buf; } size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); From 23ec9287c925b55a25b0090b6bf4209878e94f78 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 3 Apr 2023 17:58:43 +0800 Subject: [PATCH 3/9] fix: fix tsim crash on windows due to invalid input to strftime --- include/common/ttime.h | 2 +- include/os/osTime.h | 2 +- source/common/src/tdatablock.c | 3 +-- source/common/src/ttime.c | 20 +++++++--------- source/libs/executor/src/scanoperator.c | 2 +- source/libs/executor/src/timewindowoperator.c | 2 +- source/libs/function/src/builtins.c | 3 +-- source/libs/scalar/src/sclfunc.c | 3 +-- source/os/src/osTime.c | 24 ++++++++++++++++--- source/os/src/osTimezone.c | 6 ++--- source/util/src/tlog.c | 4 ++-- tools/shell/src/shellEngine.c | 3 +-- utils/test/c/tmqDemo.c | 2 +- utils/test/c/tmqSim.c | 5 ++-- utils/tsim/src/simExe.c | 3 +-- 15 files changed, 46 insertions(+), 38 deletions(-) diff --git a/include/common/ttime.h b/include/common/ttime.h index 4a7c47d172..f189959f22 100644 --- a/include/common/ttime.h +++ b/include/common/ttime.h @@ -64,7 +64,7 @@ static FORCE_INLINE int64_t taosGetTimestampToday(int32_t precision) { : 1000000000; time_t t = taosTime(NULL); struct tm tm; - taosLocalTime(&t, &tm); + taosLocalTime(&t, &tm, NULL); tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; diff --git a/include/os/osTime.h b/include/os/osTime.h index 0a0a54119b..51a285a139 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -91,7 +91,7 @@ static FORCE_INLINE int64_t taosGetMonoTimestampMs() { } char *taosStrpTime(const char *buf, const char *fmt, struct tm *tm); -struct tm *taosLocalTime(const time_t *timep, struct tm *result); +struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf); struct tm *taosLocalTimeNolock(struct tm *result, const time_t *timep, int dst); time_t taosTime(time_t *t); time_t taosMktime(struct tm *timep); diff --git a/source/common/src/tdatablock.c b/source/common/src/tdatablock.c index eeb2d4ff2e..03102b11a3 100644 --- a/source/common/src/tdatablock.c +++ b/source/common/src/tdatablock.c @@ -1864,8 +1864,7 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { } } struct tm ptm = {0}; - if (taosLocalTime(&tt, &ptm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&tt, &ptm, buf) == NULL) { return buf; } size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 2f39cdeaa0..dcd539bd91 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -727,7 +727,7 @@ int64_t taosTimeAdd(int64_t t, int64_t duration, char unit, int32_t precision) { struct tm tm; time_t tt = (time_t)(t / TSDB_TICK_PER_SECOND(precision)); - taosLocalTime(&tt, &tm); + taosLocalTime(&tt, &tm, NULL); int32_t mon = tm.tm_year * 12 + tm.tm_mon + (int32_t)numOfMonth; tm.tm_year = mon / 12; tm.tm_mon = mon % 12; @@ -750,11 +750,11 @@ int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char struct tm tm; time_t t = (time_t)skey; - taosLocalTime(&t, &tm); + taosLocalTime(&t, &tm, NULL); int32_t smon = tm.tm_year * 12 + tm.tm_mon; t = (time_t)ekey; - taosLocalTime(&t, &tm); + taosLocalTime(&t, &tm, NULL); int32_t emon = tm.tm_year * 12 + tm.tm_mon; if (unit == 'y') { @@ -774,7 +774,7 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio start /= (int64_t)(TSDB_TICK_PER_SECOND(precision)); struct tm tm; time_t tt = (time_t)start; - taosLocalTime(&tt, &tm); + taosLocalTime(&tt, &tm, NULL); tm.tm_sec = 0; tm.tm_min = 0; tm.tm_hour = 0; @@ -867,8 +867,7 @@ const char* fmtts(int64_t ts) { if (ts > -62135625943 && ts < 32503651200) { time_t t = (time_t)ts; - if (taosLocalTime(&t, &tm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&t, &tm, buf) == NULL) { return buf; } pos += strftime(buf + pos, sizeof(buf), "s=%Y-%m-%d %H:%M:%S", &tm); @@ -876,8 +875,7 @@ const char* fmtts(int64_t ts) { if (ts > -62135625943000 && ts < 32503651200000) { time_t t = (time_t)(ts / 1000); - if (taosLocalTime(&t, &tm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&t, &tm, buf) == NULL) { return buf; } if (pos > 0) { @@ -891,8 +889,7 @@ const char* fmtts(int64_t ts) { { time_t t = (time_t)(ts / 1000000); - if (taosLocalTime(&t, &tm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&t, &tm, buf) == NULL) { return buf; } if (pos > 0) { @@ -946,8 +943,7 @@ void taosFormatUtcTime(char* buf, int32_t bufLen, int64_t t, int32_t precision) ASSERT(false); } - if (taosLocalTime(", &ptm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(", &ptm, buf) == NULL) { return; } int32_t length = (int32_t)strftime(ts, 40, "%Y-%m-%dT%H:%M:%S", &ptm); diff --git a/source/libs/executor/src/scanoperator.c b/source/libs/executor/src/scanoperator.c index ce647014ae..be87dcd6ff 100644 --- a/source/libs/executor/src/scanoperator.c +++ b/source/libs/executor/src/scanoperator.c @@ -88,7 +88,7 @@ static void getNextTimeWindow(SInterval* pInterval, STimeWindow* tw, int32_t ord struct tm tm; time_t t = (time_t)key; - taosLocalTime(&t, &tm); + taosLocalTime(&t, &tm, NULL); int mon = (int)(tm.tm_year * 12 + tm.tm_mon + interval * factor); tm.tm_year = mon / 12; diff --git a/source/libs/executor/src/timewindowoperator.c b/source/libs/executor/src/timewindowoperator.c index fef588a503..0f2eb4e0d7 100644 --- a/source/libs/executor/src/timewindowoperator.c +++ b/source/libs/executor/src/timewindowoperator.c @@ -281,7 +281,7 @@ static void getNextTimeWindow(SInterval* pInterval, int32_t precision, int32_t o struct tm tm; time_t t = (time_t)key; - taosLocalTime(&t, &tm); + taosLocalTime(&t, &tm, NULL); int mon = (int)(tm.tm_year * 12 + tm.tm_mon + interval * factor); tm.tm_year = mon / 12; diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index f78b8039a4..22af82bceb 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -213,8 +213,7 @@ static int32_t addTimezoneParam(SNodeList* pList) { char buf[6] = {0}; time_t t = taosTime(NULL); struct tm tmInfo; - if (taosLocalTime(&t, &tmInfo) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&t, &tmInfo, buf) == NULL) { } else { strftime(buf, sizeof(buf), "%z", &tmInfo); } diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index 7f19cb7831..88362201b4 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -1069,8 +1069,7 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * struct tm tmInfo; int32_t len = 0; - if (taosLocalTime((const time_t *)&timeVal, &tmInfo) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime((const time_t *)&timeVal, &tmInfo, buf) == NULL) { len = (int32_t)strlen(buf); goto _end; } diff --git a/source/os/src/osTime.c b/source/os/src/osTime.c index 5d5bff8c48..f120b6650a 100644 --- a/source/os/src/osTime.c +++ b/source/os/src/osTime.c @@ -407,12 +407,21 @@ time_t taosMktime(struct tm *timep) { #endif } -struct tm *taosLocalTime(const time_t *timep, struct tm *result) { +struct tm *taosLocalTime(const time_t *timep, struct tm *result, char *buf) { + struct tm *res = NULL; + if (result == NULL) { - return localtime(timep); + res = localtime(timep); + if (res == NULL && buf != NULL) { + sprintf(buf, "NaN"); + } + return res; } #ifdef WINDOWS if (*timep < 0) { + if (buf != NULL) { + sprintf(buf, "NaN"); + } return NULL; // TODO: bugs in following code SYSTEMTIME ss, s; @@ -421,6 +430,9 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) { struct tm tm1; time_t tt = 0; if (localtime_s(&tm1, &tt) != 0 ) { + if (buf != NULL) { + sprintf(buf, "NaN"); + } return NULL; } ss.wYear = tm1.tm_year + 1900; @@ -449,11 +461,17 @@ struct tm *taosLocalTime(const time_t *timep, struct tm *result) { result->tm_isdst = 0; } else { if (localtime_s(result, timep) != 0) { + if (buf != NULL) { + sprintf(buf, "NaN"); + } return NULL; } } #else - localtime_r(timep, result); + res = localtime_r(timep, result); + if (res == NULL && buf != NULL) { + sprintf(buf, "NaN"); + } #endif return result; } diff --git a/source/os/src/osTimezone.c b/source/os/src/osTimezone.c index ad223bff27..cd6ad7cdb5 100644 --- a/source/os/src/osTimezone.c +++ b/source/os/src/osTimezone.c @@ -893,7 +893,7 @@ void taosGetSystemTimezone(char *outTimezoneStr, enum TdTimezone *tsTimezone) { */ time_t tx1 = taosGetTimestampSec(); struct tm tm1; - taosLocalTime(&tx1, &tm1); + taosLocalTime(&tx1, &tm1, NULL); daylight = tm1.tm_isdst; /* @@ -921,7 +921,7 @@ void taosGetSystemTimezone(char *outTimezoneStr, enum TdTimezone *tsTimezone) { */ time_t tx1 = taosGetTimestampSec(); struct tm tm1; - taosLocalTime(&tx1, &tm1); + taosLocalTime(&tx1, &tm1, NULL); /* load time zone string from /etc/timezone */ // FILE *f = fopen("/etc/timezone", "r"); errno = 0; @@ -1008,7 +1008,7 @@ void taosGetSystemTimezone(char *outTimezoneStr, enum TdTimezone *tsTimezone) { */ time_t tx1 = taosGetTimestampSec(); struct tm tm1; - taosLocalTime(&tx1, &tm1); + taosLocalTime(&tx1, &tm1, NULL); /* * format example: diff --git a/source/util/src/tlog.c b/source/util/src/tlog.c index bd9ea058b4..a3d3c399ab 100644 --- a/source/util/src/tlog.c +++ b/source/util/src/tlog.c @@ -121,7 +121,7 @@ static FORCE_INLINE void taosUpdateDaylight() { struct timeval timeSecs; taosGetTimeOfDay(&timeSecs); time_t curTime = timeSecs.tv_sec; - ptm = taosLocalTime(&curTime, &Tm); + ptm = taosLocalTime(&curTime, &Tm, NULL); tsDaylightActive = ptm->tm_isdst; } static FORCE_INLINE int32_t taosGetDaylight() { return tsDaylightActive; } @@ -437,7 +437,7 @@ static inline int32_t taosBuildLogHead(char *buffer, const char *flags) { taosGetTimeOfDay(&timeSecs); time_t curTime = timeSecs.tv_sec; - ptm = taosLocalTime(&curTime, &Tm); + ptm = taosLocalTime(&curTime, &Tm, NULL); return sprintf(buffer, "%02d/%02d %02d:%02d:%02d.%06d %08" PRId64 " %s", ptm->tm_mon + 1, ptm->tm_mday, ptm->tm_hour, ptm->tm_min, ptm->tm_sec, (int32_t)timeSecs.tv_usec, taosGetSelfPthreadId(), flags); diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index a87ba16267..616540a54a 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -291,8 +291,7 @@ char *shellFormatTimestamp(char *buf, int64_t val, int32_t precision) { } struct tm ptm = {0}; - if (taosLocalTime(&tt, &ptm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&tt, &ptm, buf) == NULL) { return buf; } size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); diff --git a/utils/test/c/tmqDemo.c b/utils/test/c/tmqDemo.c index d105b50579..ce069c2b05 100644 --- a/utils/test/c/tmqDemo.c +++ b/utils/test/c/tmqDemo.c @@ -597,7 +597,7 @@ void printParaIntoFile() { time_t tTime = taosGetTimestampSec(); struct tm tm; - taosLocalTime(&tTime, &tm); + taosLocalTime(&tTime, &tm, NULL); taosFprintfFile(pFile, "###################################################################\n"); taosFprintfFile(pFile, "# configDir: %s\n", configDir); diff --git a/utils/test/c/tmqSim.c b/utils/test/c/tmqSim.c index 5eeb0aaa12..f2de219f4e 100644 --- a/utils/test/c/tmqSim.c +++ b/utils/test/c/tmqSim.c @@ -166,7 +166,7 @@ static void printHelp() { char* getCurrentTimeString(char* timeString) { time_t tTime = taosGetTimestampSec(); struct tm tm; - taosLocalTime(&tTime, &tm); + taosLocalTime(&tTime, &tm, NULL); sprintf(timeString, "%d-%02d-%02d %02d:%02d:%02d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); @@ -472,8 +472,7 @@ static char* shellFormatTimestamp(char* buf, int64_t val, int32_t precision) { } struct tm ptm; - if (taosLocalTime(&tt, &ptm) == NULL) { - sprintf(buf, "NaN"); + if (taosLocalTime(&tt, &ptm, buf) == NULL) { return buf; } size_t pos = strftime(buf, 35, "%Y-%m-%d %H:%M:%S", &ptm); diff --git a/utils/tsim/src/simExe.c b/utils/tsim/src/simExe.c index 07b3648f3a..1be28635ef 100644 --- a/utils/tsim/src/simExe.c +++ b/utils/tsim/src/simExe.c @@ -772,8 +772,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { tt = (*(int64_t *)row[i]) / 1000000000; } - if (taosLocalTime(&tt, &tp) == NULL) { - sprintf(timeStr, "NaN"); + if (taosLocalTime(&tt, &tp, timeStr) == NULL) { break; } strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", &tp); From 4819b22a21424d57bf730de9a61ec95a0cf29ae4 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Mon, 3 Apr 2023 17:58:43 +0800 Subject: [PATCH 4/9] fix: fix tsim crash on windows due to invalid input to strftime --- source/libs/function/src/builtins.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/libs/function/src/builtins.c b/source/libs/function/src/builtins.c index 22af82bceb..e2b68a8b05 100644 --- a/source/libs/function/src/builtins.c +++ b/source/libs/function/src/builtins.c @@ -213,8 +213,7 @@ static int32_t addTimezoneParam(SNodeList* pList) { char buf[6] = {0}; time_t t = taosTime(NULL); struct tm tmInfo; - if (taosLocalTime(&t, &tmInfo, buf) == NULL) { - } else { + if (taosLocalTime(&t, &tmInfo, buf) != NULL) { strftime(buf, sizeof(buf), "%z", &tmInfo); } int32_t len = (int32_t)strlen(buf); From 22a876bcdf188d734efba4194110052729c7abf8 Mon Sep 17 00:00:00 2001 From: xiaolei li <85657333+xleili@users.noreply.github.com> Date: Tue, 4 Apr 2023 18:45:24 +0800 Subject: [PATCH 5/9] docs: release 3.0.3.2 (#20765) --- docs/en/28-releases/01-tdengine.md | 4 ++++ docs/en/28-releases/02-tools.md | 4 ++++ docs/zh/28-releases/01-tdengine.md | 4 ++++ docs/zh/28-releases/02-tools.md | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 9910a3d89a..730aa7c4f1 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -14,6 +14,10 @@ import Release from "/components/ReleaseV3"; +## 3.0.3.1 + + + ## 3.0.3.0 diff --git a/docs/en/28-releases/02-tools.md b/docs/en/28-releases/02-tools.md index a060d2dd77..17581b780a 100644 --- a/docs/en/28-releases/02-tools.md +++ b/docs/en/28-releases/02-tools.md @@ -10,6 +10,10 @@ For other historical version installers, please visit [here](https://www.taosdat import Release from "/components/ReleaseV3"; +## 2.4.11 + + + ## 2.4.10 diff --git a/docs/zh/28-releases/01-tdengine.md b/docs/zh/28-releases/01-tdengine.md index 62d5c5f592..b4441ad078 100644 --- a/docs/zh/28-releases/01-tdengine.md +++ b/docs/zh/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ TDengine 2.x 各版本安装包请访问[这里](https://www.taosdata.com/all-do import Release from "/components/ReleaseV3"; +## 3.0.3.2 + + + ## 3.0.3.1 diff --git a/docs/zh/28-releases/02-tools.md b/docs/zh/28-releases/02-tools.md index 0e4eda6001..cce6834f12 100644 --- a/docs/zh/28-releases/02-tools.md +++ b/docs/zh/28-releases/02-tools.md @@ -10,6 +10,10 @@ taosTools 各版本安装包下载链接如下: import Release from "/components/ReleaseV3"; +## 2.4.11 + + + ## 2.4.10 From debe63ca9c7811c5daf2f1e8762829c3c9e0b058 Mon Sep 17 00:00:00 2001 From: xiaolei li <85657333+xleili@users.noreply.github.com> Date: Tue, 4 Apr 2023 18:48:30 +0800 Subject: [PATCH 6/9] release: upgrade 3.0 default version to 3.0.3.2 (#20768) --- cmake/cmake.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cmake.version b/cmake/cmake.version index de85025a8c..29f560148e 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -2,7 +2,7 @@ IF (DEFINED VERNUMBER) SET(TD_VER_NUMBER ${VERNUMBER}) ELSE () - SET(TD_VER_NUMBER "3.0.3.1") + SET(TD_VER_NUMBER "3.0.3.2") ENDIF () IF (DEFINED VERCOMPATIBLE) From 42973676cea687b6ad029643f0bbe9ced6cb8c68 Mon Sep 17 00:00:00 2001 From: xiaolei li <85657333+xleili@users.noreply.github.com> Date: Tue, 4 Apr 2023 19:04:33 +0800 Subject: [PATCH 7/9] docs/3.0.3.2 (#20776) * docs: release 3.0.3.2 * docs: release 3.0.3.2 --- docs/en/28-releases/01-tdengine.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/28-releases/01-tdengine.md b/docs/en/28-releases/01-tdengine.md index 730aa7c4f1..b160058d02 100644 --- a/docs/en/28-releases/01-tdengine.md +++ b/docs/en/28-releases/01-tdengine.md @@ -10,6 +10,10 @@ For TDengine 2.x installation packages by version, please visit [here](https://w import Release from "/components/ReleaseV3"; +## 3.0.3.2 + + + ## 3.0.3.1 From 33c5f1cf8862dbce6fb8305342dca5e843348f60 Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 5 Apr 2023 10:21:43 +0800 Subject: [PATCH 8/9] chore: cus name support in shellArgument (#20754) * chore: refactor cus prompt * fix: client name in install.sh * fix: -Wno-reserved-user-defined-literal * fix: update taos-tools commit * fix: include/os/osDir.h * fix: check cus name * fix: makepkg.sh * chore: update taos-tools d194dc9 * fix: cus name * fix: change adapter prefix * fix: tools/*.sh * fix: scripts * fix: ../../packaging/tools/install_client.sh * chore: cus domain in script * fix: cus name in packaging/tools/install.sh * fix: cus name in ../../packaging/tools/remove.sh * fix: don't edit origin file * fix: remove brand name * fix: update taos-tools * fix: cus name in log * fix: compile error without cuc name --------- Co-authored-by: chenhaoran --- cmake/taostools_CMakeLists.txt.in | 2 +- source/dnode/mgmt/exe/dmMain.c | 17 ++++++++++++++++- tools/shell/src/shellArguments.c | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index 2de3881dd2..a4edc47c0b 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 273a3fe + GIT_TAG 53d14fa SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index d3cffaa185..892b4a9a40 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -19,6 +19,21 @@ #include "tconfig.h" #include "tglobal.h" +#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) +#include "cus_name.h" +#else +#ifndef CUS_NAME + #define CUS_NAME "TDengine" +#endif + +#ifndef CUS_PROMPT + #define CUS_PROMPT "taos" +#endif + +#ifndef CUS_EMAIL + #define CUS_EMAIL "" +#endif +#endif // clang-format off #define DM_APOLLO_URL "The apollo string to use when configuring the server, such as: -a 'jsonFile:./tests/cfg.json', cfg.json text can be '{\"fqdn\":\"td1\"}'." #define DM_CFG_DIR "Configuration directory." @@ -228,7 +243,7 @@ static void dmDumpCfg() { } static int32_t dmInitLog() { - return taosCreateLog("taosdlog", 1, configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0); + return taosCreateLog(CUS_PROMPT"dlog", 1, configDir, global.envCmd, global.envFile, global.apolloUrl, global.pArgs, 0); } static void taosCleanupArgs() { diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index f7008548f6..1eb4edb28a 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -46,7 +46,7 @@ #define SHELL_VERSION "Print program version." #ifdef WEBSOCKET -#define SHELL_DSN "Use dsn to connect to the TDengine cloud server or to a remote server which provides WebSocket connection." +#define SHELL_DSN "Use dsn to connect to the cloud server or to a remote server which provides WebSocket connection." #define SHELL_REST "Use RESTful mode when connecting." #define SHELL_TIMEOUT "Set the timeout for websocket query in seconds, default is 30." #endif From 79461d918333ed5b6cf1219c03c5efcbfe67c32f Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Wed, 5 Apr 2023 12:18:09 +0800 Subject: [PATCH 9/9] fix: taosbenchmark disorder range dynamic (#20772) --- cmake/taostools_CMakeLists.txt.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/taostools_CMakeLists.txt.in b/cmake/taostools_CMakeLists.txt.in index a4edc47c0b..3f27cb2517 100644 --- a/cmake/taostools_CMakeLists.txt.in +++ b/cmake/taostools_CMakeLists.txt.in @@ -2,7 +2,7 @@ # taos-tools ExternalProject_Add(taos-tools GIT_REPOSITORY https://github.com/taosdata/taos-tools.git - GIT_TAG 53d14fa + GIT_TAG ddd654a SOURCE_DIR "${TD_SOURCE_DIR}/tools/taos-tools" BINARY_DIR "" #BUILD_IN_SOURCE TRUE