From: Willy Tarreau Date: Mon, 14 Apr 2025 16:45:35 +0000 (+0200) Subject: BUG/MINOR: debug: remove the trailing \n from BUG_ON() statements X-Git-Tag: v3.2-dev11~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23705564ae1bb95d7721bc921d58c508e76c7070;p=thirdparty%2Fhaproxy.git BUG/MINOR: debug: remove the trailing \n from BUG_ON() statements These ones were added by mistake during the change of the cfgparse mechanism in 3.1, but they're corrupting the output of "debug counters" by leaving stray ']' on their own lines. We could possibly check them all once at boot but it doens't seem worth it. This should be backported to 3.1. --- diff --git a/src/cfgparse-global.c b/src/cfgparse-global.c index ba69ed1af..caf89df75 100644 --- a/src/cfgparse-global.c +++ b/src/cfgparse-global.c @@ -983,7 +983,7 @@ static int cfg_parse_global_mode(char **args, int section_type, global.mode |= MODE_ZERO_WARNING; } else { - BUG_ON(1, "Triggered in cfg_parse_global_mode() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_mode() by unsupported keyword."); return -1; } @@ -1014,7 +1014,7 @@ static int cfg_parse_global_disable_poller(char **args, int section_type, global.tune.options &= ~GTUNE_USE_POLL; } else { - BUG_ON(1, "Triggered in cfg_parse_global_disable_poller() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_disable_poller() by unsupported keyword."); return -1; } @@ -1042,7 +1042,7 @@ static int cfg_parse_global_pidfile(char **args, int section_type, } global.pidfile = strdup(args[1]); } else { - BUG_ON(1, "Triggered in cfg_parse_global_pidfile() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_pidfile() by unsupported keyword."); return -1; } @@ -1062,7 +1062,7 @@ static int cfg_parse_global_non_std_directives(char **args, int section_type, } else if (strcmp(args[0], "expose-experimental-directives") == 0) { experimental_directives_allowed = 1; } else { - BUG_ON(1, "Triggered in cfg_parse_global_non_std_directives() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_non_std_directives() by unsupported keyword."); return -1; } @@ -1365,7 +1365,7 @@ static int cfg_parse_global_tune_opts(char **args, int section_type, } } else { - BUG_ON(1, "Triggered in cfg_parse_global_tune_opts() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_tune_opts() by unsupported keyword."); return -1; } @@ -1398,7 +1398,7 @@ static int cfg_parse_global_tune_forward_opts(char **args, int section_type, global.tune.no_zero_copy_fwd |= NO_ZERO_COPY_FWD; } else { - BUG_ON(1, "Triggered in cfg_parse_global_tune_forward_opts() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_tune_forward_opts() by unsupported keyword."); return -1; } @@ -1418,7 +1418,7 @@ static int cfg_parse_global_unsupported_opts(char **args, int section_type, memprintf(err, "option '%s' is not supported any more (tune.bufsize is used instead).", args[0]); } else { - BUG_ON(1, "Triggered in cfg_parse_global_unsupported_opts() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_unsupported_opts() by unsupported keyword."); } return -1; @@ -1501,7 +1501,7 @@ static int cfg_parse_global_env_opts(char **args, int section_type, } } else { - BUG_ON(1, "Triggered in cfg_parse_global_env_opts() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_global_env_opts() by unsupported keyword."); return -1; } @@ -1592,7 +1592,7 @@ static int cfg_parse_tune_renice(char **args, int section_type, struct proxy *cu } } else { - BUG_ON(1, "Triggered in cfg_parse_tune_renice() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in cfg_parse_tune_renice() by unsupported keyword."); } return 0; diff --git a/src/cli.c b/src/cli.c index 28619dd47..f06f3c907 100644 --- a/src/cli.c +++ b/src/cli.c @@ -2514,7 +2514,7 @@ static int _send_status(char **args, char *payload, struct appctx *appctx, void int pid; BUG_ON((strcmp(args[0], "_send_status") != 0), - "Triggered in _send_status by unsupported command name.\n"); + "Triggered in _send_status by unsupported command name."); pid = atoi(args[2]); @@ -3530,7 +3530,7 @@ int mworker_cli_attach_server(char **errmsg) struct mworker_proc *child; BUG_ON((mworker_proxy == NULL), "Triggered in mworker_cli_attach_server(), " - "mworker_proxy must be created before this call.\n"); + "mworker_proxy must be created before this call."); /* create all servers using the mworker_proc list */ list_for_each_entry(child, &proc_list, list) { diff --git a/src/mworker.c b/src/mworker.c index 68dd0f876..7cbe9ff6d 100644 --- a/src/mworker.c +++ b/src/mworker.c @@ -1043,7 +1043,7 @@ static int mworker_parse_global_max_reloads(char **args, int section_type, struc return -1; } } else { - BUG_ON(1, "Triggered in mworker_parse_global_max_reloads() by unsupported keyword.\n"); + BUG_ON(1, "Triggered in mworker_parse_global_max_reloads() by unsupported keyword."); return -1; } diff --git a/src/tools.c b/src/tools.c index eec6bac89..86135f6a8 100644 --- a/src/tools.c +++ b/src/tools.c @@ -7120,7 +7120,7 @@ int restore_env(void) char *value; BUG_ON(!init_env, "Triggered in restore_env(): must be preceded by " - "backup_env(), which allocates init_env.\n"); + "backup_env(), which allocates init_env."); while (*env) { pos = strchr(*env, '=');