]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: cfgparse-listen: fix quoting of the condition conflict warning
authorWilly Tarreau <w@1wt.eu>
Tue, 15 Sep 2026 14:37:58 +0000 (16:37 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 9 Oct 2026 07:22:33 +0000 (09:22 +0200)
The 10 places which report the message returned by warnif_cond_conflicts()
use "'%s.\n'" as a format, so the closing quote is emitted after the \n and
ends up alone at the beginning of the next line:

  [WARNING] : parsing [x.cfg:4] : 'acl 'a' will never match ...
  '

Let's just move the quote before the LF and even the trailing '.'.

This may be backported to all supported versions.

src/cfgparse-listen.c

index 2fa015bd722014b002d2bfe7127a22b869c93aa2..08acb5dfd659997434252291852de57eaac57185 100644 (file)
@@ -1374,7 +1374,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        where |= SMP_VAL_BE_HRQ_HDR;
                err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                LIST_APPEND(&curproxy->http_req_rules, &rule->list);
        }
@@ -1409,7 +1409,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        where |= SMP_VAL_BE_HRS_HDR;
                err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                LIST_APPEND(&curproxy->http_res_rules, &rule->list);
        }
@@ -1443,7 +1443,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        where |= SMP_VAL_BE_HRS_HDR;
                err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                LIST_APPEND(&curproxy->http_after_res_rules, &rule->list);
        }
@@ -1508,7 +1508,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                        where |= SMP_VAL_BE_HRQ_HDR;
                err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
        }
        else if (strcmp(args[0], "use_backend") == 0) {
                struct switching_rule *rule;
@@ -1538,7 +1538,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
 
                        err_code |= warnif_cond_conflicts(cond, SMP_VAL_FE_SET_BCK, &errmsg);
                        if (errmsg)
-                               ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                               ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
                }
                else if (*args[2]) {
                        ha_alert("parsing [%s:%d] : unexpected keyword '%s' after switching rule, only 'if' and 'unless' are allowed.\n",
@@ -1601,7 +1601,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
 
                err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_SET_SRV, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                rule = calloc(1, sizeof(*rule));
                if (!rule)
@@ -1656,7 +1656,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                 */
                err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_REQ_CNT, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                rule = calloc(1, sizeof(*rule));
                if (!rule) {
@@ -1824,7 +1824,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                else
                        err_code |= warnif_cond_conflicts(cond, SMP_VAL_BE_SET_SRV, &errmsg);
                if (errmsg)
-                       ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                       ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                rule = calloc(1, sizeof(*rule));
                if (!rule) {
@@ -1882,7 +1882,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                where |= SMP_VAL_BE_HRQ_HDR;
                        err_code |= warnif_cond_conflicts(cond, where, &errmsg);
                        if (errmsg)
-                               ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                               ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
 
                        rule = calloc(1, sizeof(*rule));
                        if (!rule) {
@@ -1962,7 +1962,7 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
                                where |= SMP_VAL_BE_HRQ_HDR;
                        err_code |= warnif_cond_conflicts(rule->cond, where, &errmsg);
                        if (errmsg)
-                               ha_warning("parsing [%s:%d] : '%s.\n'", file, linenum, errmsg);
+                               ha_warning("parsing [%s:%d] : '%s'.\n", file, linenum, errmsg);
                        LIST_APPEND(&curproxy->uri_auth->http_req_rules, &rule->list);
 
                } else if (strcmp(args[1], "auth") == 0) {