Changeset: 0d7f1aef4be2 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/0d7f1aef4be2 Modified Files: ChangeLog tools/merovingian/daemon/argvcmds.c tools/merovingian/daemon/merovingian.c tools/merovingian/utils/utils.c Branch: default Log Message:
Set default to 'no' of monetdbd discovery property. Also set 'no' instead of 'false' for monetdbd control property. In practice they achieve the same, but setting it to 'no' saves a write to monetdbd properties file. diffs (truncated from 317 to 300 lines): diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog file for devel # This file is updated with Maddlog +* Sat May 2 2026 Lucas Pereira <[email protected]> +- Set default to 'no' of monetdbd discovery property. + * Thu Feb 19 2026 Sjoerd Mullender <[email protected]> - Changed the BATloop macro so that it now has a BATiter pointer as first argument. diff --git a/tools/merovingian/daemon/argvcmds.c b/tools/merovingian/daemon/argvcmds.c --- a/tools/merovingian/daemon/argvcmds.c +++ b/tools/merovingian/daemon/argvcmds.c @@ -87,7 +87,7 @@ command_create(int argc, char *argv[]) char path[2048]; char *p; char *dbfarm; - confkeyval phrase[2]; + confkeyval phrase[1]; if (argc != 2) { command_help(2, &argv[-1]); @@ -103,15 +103,15 @@ command_create(int argc, char *argv[]) *p = '\0'; if (mkdir(path, 0755) == -1 && errno != EEXIST) { fprintf(stderr, - "unable to create directory '%s': %s\n", - path, strerror(errno)); + "unable to create directory '%s': %s\n", + path, strerror(errno)); return(1); } *p = '/'; } if (mkdir(dbfarm, 0755) == -1 && errno != EEXIST) { fprintf(stderr, "unable to create directory '%s': %s\n", - dbfarm, strerror(errno)); + dbfarm, strerror(errno)); return(1); } @@ -121,9 +121,9 @@ command_create(int argc, char *argv[]) return(1); } - phrase[0].key = "control"; - phrase[0].val = "false"; - phrase[1].key = NULL; + /* phrase[0].key = "control"; */ + /* phrase[0].val = "false"; */ + /* phrase[1].key = NULL; */ if (writeProps(phrase, dbfarm) != 0) { fprintf(stderr, "unable to create file in directory '%s': %s\n", dbfarm, strerror(errno)); diff --git a/tools/merovingian/daemon/merovingian.c b/tools/merovingian/daemon/merovingian.c --- a/tools/merovingian/daemon/merovingian.c +++ b/tools/merovingian/daemon/merovingian.c @@ -452,32 +452,26 @@ main(int argc, char *argv[]) int thret; bool merodontfork = false; confkeyval ckv[] = { - {"logfile", strdup("merovingian.log"), 0, STR}, - {"pidfile", strdup("merovingian.pid"), 0, STR}, - {"loglevel", strdup("information"), INFORMATION, LOGLEVEL}, - - {"sockdir", strdup("/tmp"), 0, STR}, - {"listenaddr", strdup("localhost"), 0, LADDR}, - {"port", strdup(MERO_PORT), atoi(MERO_PORT), INT}, - - {"exittimeout", strdup("60"), 60, SINT}, - {"forward", strdup("proxy"), 0, OTHER}, - - {"discovery", strdup("true"), 1, BOOLEAN}, - {"discoveryttl", strdup("600"), 600, INT}, - - {"control", strdup("false"), 0, BOOLEAN}, - {"passphrase", NULL, 0, STR}, - - {"snapshotdir", NULL, 0, STR}, + {"logfile", strdup("merovingian.log"), 0, STR}, + {"pidfile", strdup("merovingian.pid"), 0, STR}, + {"loglevel", strdup("information"), INFORMATION, LOGLEVEL}, + {"sockdir", strdup("/tmp"), 0, STR}, + {"listenaddr", strdup("localhost"), 0, LADDR}, + {"port", strdup(MERO_PORT), atoi(MERO_PORT), INT}, + {"exittimeout", strdup("60"), 60, SINT}, + {"forward", strdup("proxy"), 0, OTHER}, + {"discovery", strdup("no"), 0, BOOLEAN}, + {"discoveryttl", strdup("600"), 600, INT}, + {"control", strdup("no"), 0, BOOLEAN}, + {"passphrase", NULL, 0, STR}, + {"snapshotdir", NULL, 0, STR}, #ifdef HAVE_LIBLZ4 - {"snapshotcompression", strdup(".tar.lz4"), 0, STR}, + {"snapshotcompression", strdup(".tar.lz4"), 0, STR}, #else - {"snapshotcompression", strdup(".tar"), 0, STR}, + {"snapshotcompression", strdup(".tar"), 0, STR}, #endif - {"keepalive", strdup("60"), 60, INT}, - - { NULL, NULL, 0, INVALID} + {"keepalive", strdup("60"), 60, INT}, + { NULL, NULL, 0, INVALID} }; confkeyval *kv; int retfd = -1; diff --git a/tools/merovingian/utils/utils.c b/tools/merovingian/utils/utils.c --- a/tools/merovingian/utils/utils.c +++ b/tools/merovingian/utils/utils.c @@ -213,107 +213,107 @@ setConfVal(confkeyval *ckv, const char * /* check the input */ switch (ckv->type) { - case INVALID: { + case INVALID: { + char buf[256]; + snprintf(buf, sizeof(buf), + "key '%s' is uninitialised (invalid value), internal error", + ckv->key); + return(strdup(buf)); + } + case SINT: + case INT: { + const char *p = val; + int sign = 1; + if (ckv->type == SINT && *p == '-') { + sign = -1; + p++; + } + while (isdigit((unsigned char) *p)) + p++; + if (*p != '\0') { char buf[256]; snprintf(buf, sizeof(buf), - "key '%s' is uninitialised (invalid value), internal error", - ckv->key); + "key '%s' requires an integer-type value, got: %s", + ckv->key, val); + return(strdup(buf)); + } + ival = sign * atoi(val); + break; + } + case BOOLEAN: + if (strcasecmp(val, "true") == 0 || + strcasecmp(val, "yes") == 0 || + strcmp(val, "1") == 0) + { + val = "yes"; + ival = 1; + } else if (strcasecmp(val, "false") == 0 || + strcasecmp(val, "no") == 0 || + strcmp(val, "0") == 0) + { + val = "no"; + ival = 0; + } else { + char buf[256]; + snprintf(buf, sizeof(buf), + "key '%s' requires a boolean-type value, got: %s", + ckv->key, val); return(strdup(buf)); } - case SINT: - case INT: { - const char *p = val; - int sign = 1; - if (ckv->type == SINT && *p == '-') { - sign = -1; - p++; - } - while (isdigit((unsigned char) *p)) - p++; - if (*p != '\0') { - char buf[256]; - snprintf(buf, sizeof(buf), - "key '%s' requires an integer-type value, got: %s", - ckv->key, val); - return(strdup(buf)); - } - ival = sign * atoi(val); - break; + break; + case MURI: + if (strncmp(val, "mapi:monetdb://", + sizeof("mapi:monetdb://") -1) != 0) + { + char buf[256]; + snprintf(buf, sizeof(buf), + "key '%s' requires a mapi:monetdb:// URI value, got: %s", + ckv->key, val); + return(strdup(buf)); + } + /* TODO: check full URL? */ + break; + case LADDR: + if (strncmp(val, "127.0.0.1", strlen("127.0.0.1")) != 0 && + strncmp(val, "0.0.0.0", strlen("0.0.0.0")) != 0 && + strncmp(val, "::", 2) != 0 && + strncmp(val, "::1", 3) != 0 && + strncmp(val, "localhost", strlen("localhost")) != 0 && + strncmp(val, "all", strlen("all")) != 0 + ) { + char buf[256]; + snprintf(buf, sizeof(buf), + "only valid values for %s are \"127.0.0.1\", \"0.0.0.0\", \"::1\", \"::\", \"localhost\" or \"all\"\n", + ckv->key); + return(strdup(buf)); } - case BOOLEAN: - if (strcasecmp(val, "true") == 0 || - strcasecmp(val, "yes") == 0 || - strcmp(val, "1") == 0) - { - val = "yes"; - ival = 1; - } else if (strcasecmp(val, "false") == 0 || - strcasecmp(val, "no") == 0 || - strcmp(val, "0") == 0) - { - val = "no"; - ival = 0; - } else { - char buf[256]; - snprintf(buf, sizeof(buf), - "key '%s' requires a boolean-type value, got: %s", - ckv->key, val); - return(strdup(buf)); - } - break; - case MURI: - if (strncmp(val, "mapi:monetdb://", - sizeof("mapi:monetdb://") -1) != 0) - { - char buf[256]; - snprintf(buf, sizeof(buf), - "key '%s' requires a mapi:monetdb:// URI value, got: %s", - ckv->key, val); - return(strdup(buf)); - } - /* TODO: check full URL? */ - break; - case LADDR: - if (strncmp(val, "127.0.0.1", strlen("127.0.0.1")) != 0 && - strncmp(val, "0.0.0.0", strlen("0.0.0.0")) != 0 && - strncmp(val, "::", 2) != 0 && - strncmp(val, "::1", 3) != 0 && - strncmp(val, "localhost", strlen("localhost")) != 0 && - strncmp(val, "all", strlen("all")) != 0 - ) { - char buf[256]; - snprintf(buf, sizeof(buf), - "only valid values for %s are \"127.0.0.1\", \"0.0.0.0\", \"::1\", \"::\", \"localhost\" or \"all\"\n", - ckv->key); - return(strdup(buf)); - } - break; - case LOGLEVEL: - if (strcasecmp(val, "error") == 0) { - val = "error"; - ival = ERROR; - } else if (strcasecmp(val, "warning") == 0) { - val = "warning"; - ival = WARNING; - } else if (strcasecmp(val, "information") == 0) { - val = "information"; - ival = INFORMATION; - } else if (strcasecmp(val, "debug") == 0) { - val = "debug"; - ival = DEBUG; - } else { - return(strdup("allowed loglevel values are: error or warning or information or debug\n")); - } - break; - case MODS: - for (size_t i = 0; val[i]; i++) { - if (val[i] < ' ' || val[i] == '\\' || val[i] == '/' || val[i] >= 0177) - return strdup("only printable ASCII character other than \\ and / allowed"); - } - /* fall through */ - case STR: - case OTHER: - /* leave as is, not much to check */ + break; + case LOGLEVEL: + if (strcasecmp(val, "error") == 0) { + val = "error"; + ival = ERROR; + } else if (strcasecmp(val, "warning") == 0) { + val = "warning"; + ival = WARNING; + } else if (strcasecmp(val, "information") == 0) { + val = "information"; + ival = INFORMATION; + } else if (strcasecmp(val, "debug") == 0) { + val = "debug"; _______________________________________________ checkin-list mailing list -- [email protected] To unsubscribe send an email to [email protected]
