]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: emit warning for empty args when *not* in discovery mode
authorWilly Tarreau <w@1wt.eu>
Thu, 6 Nov 2025 16:57:37 +0000 (17:57 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 6 Nov 2025 18:57:44 +0000 (19:57 +0100)
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

index 5a7ec7405006b79111659207df9ff612677282eb..bf1c4d1faf7974ab5428228b173c2f0d61d52322 100644 (file)
@@ -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;