]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: config: fix arg number reported on empty arg warning
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 4 Jun 2025 13:36:13 +0000 (15:36 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 6 Jun 2025 15:03:02 +0000 (17:03 +0200)
If an empty argument is used in configuration, for example due to an
undefined environment variable, the rest of the line is not parsed. As
such, a warning is emitted to report this.

The warning was not totally correct as it reported the wrong argument
index. Fix this by this patch. Note that there is still an issue with
the "^" indicator, but this is not as easy to fix yet.

This is related to github issue #2995.

This should be backported up to 3.2.

src/cfgparse.c

index eff0c029656981dca3ce45bdb3612242fbdad713..2302602fdcfa885e1905161790babbe9bbe9c65f 100644 (file)
@@ -2087,8 +2087,8 @@ next_line:
                                                /* sanitize input line in-place */
                                                newpos = sanitize_for_printing(line, errptr - line, 80);
                                                ha_warning("parsing [%s:%d]: argument number %d at position %d is empty and marks the end of the "
-                                                          "argument list; all subsequent arguments will be ignored:\n  %s\n  %*s\n",
-                                                          file, linenum, check_arg + 1, (int)(errptr - thisline + 1), line, (int)(newpos+1), "^");
+                                                          "argument list; all subsequent arguments will be ignored:\n  %s\n  %*s\n",
+                                                          file, linenum, check_arg, (int)(errptr - thisline + 1), line, (int)(newpos + 1), "^");
                                                break;
                                        }
                                }