Revert "BUG/MINOR: config: Stopped parsing upon unmatched environment variables"

This reverts commit ff8db5a85d60b21a711f8707791119adbbcffadc.

As explained in commit #2367, finally the fix above was incorrect because
it causes other trouble such as this:

     log "192.168.100.${NODE}" "local0"

being resolved to this:

     log 192.168.100.local0

when NODE does not exist due to the loss of the spaces. In fact, while none
of us was well aware of this, when the user had:

     server app 127.0.0.1:80 "${NO_CHECK}" weight 123

in fact they should have written it this way:

     server app 127.0.0.1:80 "${NO_CHECK[*]}" weight 123

so that the variable is expanded to zero, one or multiple words, leaving
no empty arg (like in shell). This is supported since 2.3 with commit
fa41cb6 so the right fix is in the config, let's revert the fix.

This should be backported to *some* versions, but the risk that some
configs were altered to rely on the broken fix is not null. At least
recent LTS should be reverted.
This commit is contained in:
Willy Tarreau 2025-06-24 18:18:18 +02:00
parent 5694a98744
commit 4e20f786ba

View File

@ -6449,20 +6449,8 @@ uint32_t parse_line(char *in, char *out, size_t *outlen, char **args, int *nbarg
} }
} }
else { else {
/* An unmatched environment variable was parsed. /* An unmatched environment variable was parsed. */
* Let's skip the trailing double-quote character
* and spaces.
*/
in_arg = 1; in_arg = 1;
if (likely(*var_name != '.') && *in == '"') {
in++;
while (isspace((unsigned char)*in))
in++;
if (dquote) {
dquote = 0;
quote = NULL;
}
}
} }
word_expand = NULL; word_expand = NULL;
} }