]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: config: ignore empty args in skipped blocks
authorWilly Tarreau <w@1wt.eu>
Thu, 4 Dec 2025 14:21:21 +0000 (15:21 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 4 Dec 2025 14:33:43 +0000 (15:33 +0100)
commitcd959f13217786621e2fb0de8454a3d097574717
tree53242a3c848b2a11164ca3a6acb0df76a3dfc4c6
parentb29560f610527acfc617e7badf990edcae799ed3
BUG/MEDIUM: config: ignore empty args in skipped blocks

As returned by Christian Ruppert in GH issue #3203, we're having an
issue with checks for empty args in skipped blocks: the check is
performed after the line is tokenized, without considering the case
where it's disabled due to outer false .if/.else conditions. Because
of this, a test like this one:

    .if defined(SRV1_ADDR)
        server srv1 "$SRV1_ADDR"
    .endif

will fail when SRV1_ADDR is empty or not set, saying that this will
result in an empty arg on the line.

The solution consists in postponing this check after the conditions
evaluation so that disabled lines are already skipped. And for this
to be possible, we need to move "errptr" one level above so that it
remains accessible there.

This will need to be backported to 3.3 and wherever commit 1968731765
("BUG/MEDIUM: config: solve the empty argument problem again") is
backported. As such it is also related to GH issue #2367.
src/cfgparse.c