diff --git a/cmake/cmake.version b/cmake/cmake.version index ad78dbbc1e..52730e84e5 100644 --- a/cmake/cmake.version +++ b/cmake/cmake.version @@ -15,6 +15,18 @@ IF (TD_PRODUCT_NAME) ADD_DEFINITIONS(-DTD_PRODUCT_NAME="${TD_PRODUCT_NAME}") ENDIF () +IF (CUS_NAME) + ADD_DEFINITIONS(-DCUS_NAME="${CUS_NAME}") +ENDIF () + +IF (CUS_PROMPT) + ADD_DEFINITIONS(-DCUS_PROMPT="${CUS_PROMPT}") +ENDIF () + +IF (CUS_EMAIL) + ADD_DEFINITIONS(-DCUS_EMAIL="${CUS_EMAIL}") +ENDIF () + find_program(HAVE_GIT NAMES git) IF (DEFINED GITINFO) diff --git a/include/os/osDir.h b/include/os/osDir.h index c0d8530b4f..99d3ebccde 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -31,9 +31,7 @@ extern "C" { #endif -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) #include "cus_name.h" -#endif #ifdef WINDOWS diff --git a/include/util/cus_name.h b/include/util/cus_name.h index 16f677f855..fe05491742 100644 --- a/include/util/cus_name.h +++ b/include/util/cus_name.h @@ -16,12 +16,23 @@ #ifndef _CUS_NAME_H_ #define _CUS_NAME_H_ +// +// support OEM +// +#ifndef TD_PRODUCT_NAME +#ifdef TD_ENTERPRISE +#define TD_PRODUCT_NAME "TDengine Enterprise Edition" +#else +#define TD_PRODUCT_NAME "TDengine Community Edition" +#endif +#endif + #ifndef CUS_NAME #define CUS_NAME "TDengine" #endif #ifndef CUS_PROMPT -#define CUS_PROMPT "taos" +#define CUS_PROMPT "taos" #endif #ifndef CUS_EMAIL diff --git a/include/util/tdef.h b/include/util/tdef.h index f08697b0d4..6d346290bc 100644 --- a/include/util/tdef.h +++ b/include/util/tdef.h @@ -17,6 +17,7 @@ #define _TD_UTIL_DEF_H_ #include "os.h" +#include "cus_name.h" #ifdef __cplusplus extern "C" { @@ -79,14 +80,6 @@ extern const int32_t TYPE_BYTES[21]; #define TSDB_DEFAULT_PASS "taosdata" #endif -#ifndef TD_PRODUCT_NAME -#ifdef TD_ENTERPRISE -#define TD_PRODUCT_NAME "TDengine Enterprise Edition" -#else -#define TD_PRODUCT_NAME "TDengine Community Edition" -#endif -#endif - #define TSDB_TRUE 1 #define TSDB_FALSE 0 #define TSDB_OK 0 diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index b69585a356..0d4af75d04 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -38,13 +38,8 @@ #include "tversion.h" #include "tconv.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#endif -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif +#include "cus_name.h" #define TSC_VAR_NOT_RELEASE 1 #define TSC_VAR_RELEASED 0 diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index 562256f311..223418feed 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -28,9 +28,6 @@ #include "tutil.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#endif #define CONFIG_PATH_LEN (TSDB_FILENAME_LEN + 12) #define CONFIG_FILE_LEN (CONFIG_PATH_LEN + 32) diff --git a/source/dnode/mgmt/exe/dmMain.c b/source/dnode/mgmt/exe/dmMain.c index b5eeb78b5e..51e4d86acb 100644 --- a/source/dnode/mgmt/exe/dmMain.c +++ b/source/dnode/mgmt/exe/dmMain.c @@ -27,22 +27,8 @@ #include "dmUtil.h" #include "tcs.h" #include "qworker.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." diff --git a/source/dnode/vnode/src/tqCommon/tqCommon.c b/source/dnode/vnode/src/tqCommon/tqCommon.c index a73d7f849c..e9eda68cb3 100644 --- a/source/dnode/vnode/src/tqCommon/tqCommon.c +++ b/source/dnode/vnode/src/tqCommon/tqCommon.c @@ -1225,6 +1225,7 @@ int32_t tqStreamTaskProcessTaskResumeReq(void* handle, int64_t sversion, char* m streamMetaReleaseTask(pMeta, pHTask); } + streamMetaReleaseTask(pMeta, pTask); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/stream/src/streamMeta.c b/source/libs/stream/src/streamMeta.c index c2a758f490..7482c6229b 100644 --- a/source/libs/stream/src/streamMeta.c +++ b/source/libs/stream/src/streamMeta.c @@ -573,11 +573,11 @@ void streamMetaClear(SStreamMeta* pMeta) { } void streamMetaClose(SStreamMeta* pMeta) { - stDebug("vgId:%d start to close stream meta", pMeta->vgId); if (pMeta == NULL) { return; } + stDebug("vgId:%d start to close stream meta", pMeta->vgId); int32_t code = taosRemoveRef(streamMetaRefPool, pMeta->rid); if (code) { stError("vgId:%d failed to remove meta ref:%" PRId64 ", code:%s", pMeta->vgId, pMeta->rid, tstrerror(code)); diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index 526f1a33e4..6cb0e00b82 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -16,14 +16,7 @@ #define _DEFAULT_SOURCE #include "os.h" #include "taoserror.h" - -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) #include "cus_name.h" -#else -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif -#endif #define PROCESS_ITEM 12 #define UUIDLEN37 37 diff --git a/source/os/src/osTimer.c b/source/os/src/osTimer.c index fe3a0dcf95..12a43925cd 100644 --- a/source/os/src/osTimer.c +++ b/source/os/src/osTimer.c @@ -87,6 +87,8 @@ static TdThread timerThread; static timer_t timerId; static volatile bool stopTimer = false; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" static void *taosProcessAlarmSignal(void *tharg) { // Block the signal sigset_t sigset; @@ -110,8 +112,8 @@ static void *taosProcessAlarmSignal(void *tharg) { sevent.sigev_signo = SIGALRM; if (timer_create(CLOCK_REALTIME, &sevent, &timerId) == -1) { - terrno = TAOS_SYSTEM_ERROR(errno); - return NULL; + terrno = TAOS_SYSTEM_ERROR(errno); + return NULL; } taosThreadCleanupPush(taosDeleteTimer, &timerId); @@ -128,7 +130,7 @@ static void *taosProcessAlarmSignal(void *tharg) { break; } - int signo; + int signo; int32_t code = 0; while (!stopTimer) { code = sigwait(&sigset, &signo); @@ -145,6 +147,7 @@ static void *taosProcessAlarmSignal(void *tharg) { return NULL; } +#pragma GCC diagnostic pop #endif int taosInitTimer(void (*callback)(int), int ms) { diff --git a/tests/army/tools/benchmark/basic/commandline.py b/tests/army/tools/benchmark/basic/commandline.py index 0a60e1f876..94b812aed0 100644 --- a/tests/army/tools/benchmark/basic/commandline.py +++ b/tests/army/tools/benchmark/basic/commandline.py @@ -31,18 +31,16 @@ class TDTestCase(TBase): # run outputs = etool.runBinFile("taosBenchmark", "-V") print(outputs) - if len(outputs) != 3: - tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") + if len(outputs) != 4: + tdLog.exit(f"checkVersion return lines count {len(outputs)} != 4") # version string len - assert len(outputs[0]) > 27 - assert outputs[0][:22] == "taosBenchmark version:" - + assert len(outputs[1]) > 24 # commit id - assert len(outputs[1]) > 43 - assert outputs[1][:4] == "git:" + assert len(outputs[2]) > 43 + assert outputs[2][:4] == "git:" # build info - assert len(outputs[2]) > 36 - assert outputs[2][:6] == "build:" + assert len(outputs[3]) > 36 + assert outputs[3][:6] == "build:" tdLog.info("check taosBenchmark version successfully.") diff --git a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py index 6c535f794e..f1bee5bab4 100644 --- a/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py +++ b/tests/army/tools/taosdump/ws/taosdumpEscapedDb.py @@ -31,17 +31,16 @@ class TDTestCase(TBase): # run outputs = etool.runBinFile("taosdump", "-V") print(outputs) - if len(outputs) != 3: - tdLog.exit(f"checkVersion return lines count {len(outputs) != 3}") + if len(outputs) != 4: + tdLog.exit(f"checkVersion return lines count {len(outputs)} != 4") # version string len - assert len(outputs[0]) > 22 - assert outputs[0][:17] == "taosdump version:" + assert len(outputs[1]) > 19 # commit id - assert len(outputs[1]) > 43 - assert outputs[1][:4] == "git:" + assert len(outputs[2]) > 43 + assert outputs[2][:4] == "git:" # build info - assert len(outputs[2]) > 36 - assert outputs[2][:6] == "build:" + assert len(outputs[3]) > 36 + assert outputs[3][:6] == "build:" tdLog.info("check taosdump version successfully.") diff --git a/tools/shell/src/shellArguments.c b/tools/shell/src/shellArguments.c index 88918a14ac..ba210850eb 100644 --- a/tools/shell/src/shellArguments.c +++ b/tools/shell/src/shellArguments.c @@ -17,16 +17,10 @@ #include #endif +#include "cus_name.h" #include "shellInt.h" #include "version.h" -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include "cus_name.h" -#else -#ifndef CUS_PROMPT -#define CUS_PROMPT "taos" -#endif -#endif #define TAOS_CONSOLE_PROMPT_CONTINUE " -> " diff --git a/tools/shell/src/shellEngine.c b/tools/shell/src/shellEngine.c index 37da47bae6..ebec4ca06c 100644 --- a/tools/shell/src/shellEngine.c +++ b/tools/shell/src/shellEngine.c @@ -1267,6 +1267,9 @@ void *shellCancelHandler(void *arg) { return NULL; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-overflow" + void *shellThreadLoop(void *arg) { setThreadName("shellThreadLoop"); taosGetOldTerminalMode(); @@ -1298,6 +1301,7 @@ void *shellThreadLoop(void *arg) { taosThreadCleanupPop(1); return NULL; } +#pragma GCC diagnostic pop int32_t shellExecute() { printf(shell.info.clientVersion, shell.info.cusName, taos_get_client_info(), shell.info.cusName); diff --git a/tools/taos-tools/inc/dump.h b/tools/taos-tools/inc/dump.h index 1050676af3..b21dca4343 100644 --- a/tools/taos-tools/inc/dump.h +++ b/tools/taos-tools/inc/dump.h @@ -49,22 +49,6 @@ // ---------------- define ---------------- // -#if defined(CUS_NAME) || defined(CUS_PROMPT) || defined(CUS_EMAIL) -#include -#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 - // use 256 as normal buffer length #define BUFFER_LEN 256 diff --git a/tools/taos-tools/src/benchCommandOpt.c b/tools/taos-tools/src/benchCommandOpt.c index 1968a731f5..8c18b54eac 100644 --- a/tools/taos-tools/src/benchCommandOpt.c +++ b/tools/taos-tools/src/benchCommandOpt.c @@ -10,7 +10,8 @@ * FITNESS FOR A PARTICULAR PURPOSE. */ -#include + #include "cus_name.h" // include/util/ + #include #include "benchLog.h" #include @@ -29,7 +30,7 @@ char *g_aggreFunc[] = {"*", "count(*)", "avg(C0)", "sum(C0)", void printVersion() { // version, macro define in src/CMakeLists.txt - printf("taosBenchmark version: %s\n", TD_VER_NUMBER); + printf("%s\n%sBenchmark version: %s\n", TD_PRODUCT_NAME, CUS_PROMPT, TD_VER_NUMBER); printf("git: %s\n", TAOSBENCHMARK_COMMIT_ID); printf("build: %s\n", BUILD_INFO); } diff --git a/tools/taos-tools/src/benchSys.c b/tools/taos-tools/src/benchSys.c index 1a229f2cbd..9e29701515 100644 --- a/tools/taos-tools/src/benchSys.c +++ b/tools/taos-tools/src/benchSys.c @@ -12,6 +12,7 @@ #include #include #include "benchLog.h" +#include "cus_name.h" #ifdef LINUX #include @@ -21,23 +22,7 @@ #endif #endif -extern char version[]; -#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 #ifdef WINDOWS char g_configDir[MAX_PATH_LEN] = {0}; // "C:\\TDengine\\cfg"}; diff --git a/tools/taos-tools/src/taosdump.c b/tools/taos-tools/src/taosdump.c index 8593752265..d27812b67a 100644 --- a/tools/taos-tools/src/taosdump.c +++ b/tools/taos-tools/src/taosdump.c @@ -11,6 +11,7 @@ #define _GNU_SOURCE +#include "cus_name.h" // include/util/ #include "dump.h" #include "dumpUtil.h" #ifdef WEBSOCKET @@ -262,7 +263,7 @@ static void printVersion(FILE *file) { } // version, macro define in src/CMakeLists.txt - fprintf(file, "taosdump version: %s\n", TD_VER_NUMBER); + fprintf(file, "%s\n%sdump version: %s\n", TD_PRODUCT_NAME, CUS_PROMPT, TD_VER_NUMBER); fprintf(file, "git: %s\n", TAOSDUMP_COMMIT_ID); fprintf(file, "build: %s\n", BUILD_INFO); }