From: Willy Tarreau Date: Mon, 10 Aug 2026 15:01:13 +0000 (+0200) Subject: MINOR: debug: only emit and count warnings when explicitly requested X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=991887f1a32ff90a5c843f8bcfb22b0085564d93;p=thirdparty%2Fhaproxy.git MINOR: debug: only emit and count warnings when explicitly requested Previously complain() would set TAINTED_WARN was set even for a check_if() because there was no way to distinguish a warn from a check and a warn was systematically accounted for when the type was not a bug. Likewise, BUG_ON() would dump a trace whenever a non-fatal event happened, which is not the goal either as it prevents from counting events without logging them (e.g. COUNT_IF). Now that we have explicit flags for each type, let's consider them when choosing what to emit. Note that for now complain() will still log the "msg" line if used without FATL nor WARN though. --- diff --git a/include/haproxy/bug.h b/include/haproxy/bug.h index d9cb907e8..6e2968871 100644 --- a/include/haproxy/bug.h +++ b/include/haproxy/bug.h @@ -417,7 +417,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S complain(NULL, msg, details); \ if (details & DBG_DET_FAT_FATL) \ ABORT_NOW(); \ - else \ + else if (details & DBG_DET_FAT_WARN) \ ha_backtrace_to_stderr(0); \ } while (0) @@ -445,7 +445,7 @@ extern __attribute__((__weak__)) struct debug_count __stop_dbg_cnt HA_SECTION_S complain(NULL, msg, details); \ if (details & DBG_DET_FAT_FATL) \ ABORT_NOW(); \ - else \ + else if (details & DBG_DET_FAT_WARN) \ ha_backtrace_to_stderr(0); \ } while (0) diff --git a/src/debug.c b/src/debug.c index fa8b3c2c3..84d48917c 100644 --- a/src/debug.c +++ b/src/debug.c @@ -977,7 +977,7 @@ void complain(int *counter, const char *msg, uint details) DISGUISE(write(2, msg, strlen(msg))); if (details & (DBG_DET_TYP_BUG|DBG_DET_TYP_ABT)) mark_tainted(TAINTED_BUG); - else + else if (details & DBG_DET_TYP_WRN) mark_tainted(TAINTED_WARN); }