From 004e1be48e1d9471731d4a723d63fc69f6d8d211 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 6 Nov 2025 17:57:37 +0100 Subject: [PATCH] BUG/MINOR: config: emit warning for empty args when *not* in discovery mode This actually reverses the condition of commit 5f1fad1690 ("BUG/MINOR: config: emit warning for empty args only in discovery mode"). Indeed, some variables are not known in discovery mode (e.g. HAPROXY_LOCALPEER), and statements like: peer "${HAPROXY_LOCALPEER}" 127.0.0.1:10000 are broken during discovery mode. It turns out that the warning is currently hidden by commit ff8db5a85d ("BUG/MINOR: config: Stopped parsing upon unmatched environment variables") since it silently drops empty args which is sufficient to hide the warning, but it also breaks other configs and needs to be reverted, which will break configs like above again. In issue #2995 we were not fully decided about discovery mode or not, and already suspected some possible issues without being able to guess which ones. The only downside of not displaying them in discovery mode is that certain empty fields on the rare keywords specific to master mode might remain silent until used. Let's just flip the condition to check for empty args in normal mode only. This should be backported to 3.2 after some time of observation. --- src/cfgparse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cfgparse.c b/src/cfgparse.c index 5a7ec7405..bf1c4d1fa 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2068,8 +2068,8 @@ next_line: goto next_line; } - if ((global.mode & MODE_DISCOVERY)) { - /* Only print empty arg warning in discovery mode to prevent double display. */ + if (!(global.mode & MODE_DISCOVERY)) { + /* Only print empty arg warning in normal mode to prevent double display. */ for (check_arg = 0; check_arg < arg; check_arg++) { if (!*args[check_arg]) { size_t newpos; -- 2.47.3