]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: vars: make parse_store() return error on var_set() failure
authorWilly Tarreau <w@1wt.eu>
Tue, 28 Apr 2026 01:24:07 +0000 (03:24 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 30 Apr 2026 06:37:10 +0000 (08:37 +0200)
In 2.5, variables in the scope "proc" were pre-created with commit
df8eeb1619 ("MEDIUM: vars: pre-create parsed SCOPE_PROC variables as
permanent ones"). However one test on var_set() was copy-pasted from
vars_check_args() into parse_store(), and the former returns 0 on
error while for the latter it's a success. This means that some errors
on variables of scope "proc" (typically alloc failure) can be missed
at boot time, probably either making that variable invisible or causing
a crash during boot.

Let's return ACT_RET_PRS_ERR instead. This can be backported.

src/vars.c

index c8a08b5d5aad198030f65eda6cfcec3ec9120d74..ea78227701052fd59c3d4d2dbd9effa73449d67e 100644 (file)
@@ -1271,7 +1271,7 @@ static enum act_parse_ret parse_store(const char **args, int *arg, struct proxy
 
        if (rule->arg.vars.desc.scope == SCOPE_PROC &&
            !var_set(&rule->arg.vars.desc, &empty_smp, VF_CREATEONLY|VF_PERMANENT))
-               return 0;
+               return ACT_RET_PRS_ERR;
 
        /* There is no fetch method when variable is unset. Just set the right
         * action and return. */