BUG/MINOR: pattern: Properly flag virtual maps as using samples
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Sep 2025 08:03:41 +0000 (10:03 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 1 Oct 2025 14:48:35 +0000 (16:48 +0200)
commit94ad02b78a2303a184cd3688ae5224a4b0187326
treee2e71cc2911dcb4426d565b390ef6da16af2d5e2
parentda86d253eecf83c4d23dc5f1905721bab54ac86a
BUG/MINOR: pattern: Properly flag virtual maps as using samples

When a map file is load, internally, the pattern reference is flagged as
based on a sample. However it is not performed for virtual maps. This flag
is only used during startup to check the map compatibility when it used at
different places. At runtime this does not change anything. But errors can
be triggered during configuration parsing. For instance, the following valid
config will trigger an error:

    http-request set-map(virt@test) foo bar if !{ str(foo),map(virt@test) -m found }
    http-request set-var(txn.foo) str(foo),map(virt@test)

The fix is quite obvious. PAT_REF_SMP flag must be set for virtual map as
any other map.

A workaround is to use optional map (opt@...) by checking the map id cannot
reference an existing file.

This patch must be backported as far as 3.0.

(cherry picked from commit 3be8b06a60a37756a2c596f36727268cbfc4edf9)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 11a5bd0b87a26ac22f98fbffffd21fd8660b3458)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 7d2be4e74ec7bda906adfaf95ecf99e1414d39a0)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
src/pattern.c