From: Jeremy Harris Date: Tue, 9 Nov 2021 21:23:45 +0000 (+0000) Subject: Fix -be macro definition X-Git-Tag: exim-4.96-RC0~136 X-Git-Url: https://git.exim.org/exim.git/commitdiff_plain/6e05345b427859b32248c75c6f179283f6cf0382 Fix -be macro definition Broken-by: 753739fdef --- diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index a5712fce8..7f6814d5e 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -36,6 +36,10 @@ JH/08 Remove stripping of the binaries from the FreeBSD build. This was added in 4.61 without a reason logged. Binaries will be bigger, which might matter on diskspace-constrained systems, but debug is easier. +JH/09 Fix macro-definition during "-be" expansion testing. The move to + write-protected store for macros had not accounted for these runtime + additions; fix by removing this protection for "-be" mode. + Exim version 4.95 ----------------- diff --git a/src/src/exim.c b/src/src/exim.c index a31a8a1b9..133761de9 100644 --- a/src/src/exim.c +++ b/src/src/exim.c @@ -4588,7 +4588,12 @@ needed in transports so we lost the optimisation. */ store_pool = POOL_CONFIG; readconf_rest(); store_pool = old_pool; - store_writeprotect(POOL_CONFIG); + + /* -be can add macro definitions, needing to link to the macro structure + chain. Otherwise, make the memory used for config data readonly. */ + + if (!expansion_test) + store_writeprotect(POOL_CONFIG); #ifdef MEASURE_TIMING report_time_since(&t0, US"readconf_rest (delta)"); diff --git a/test/confs/0627 b/test/confs/0627 new file mode 100644 index 000000000..466698af8 --- /dev/null +++ b/test/confs/0627 @@ -0,0 +1,3 @@ +# Exim test configuration 0627 +CONFIG_MACRO = this +# End diff --git a/test/scripts/0000-Basic/0627 b/test/scripts/0000-Basic/0627 new file mode 100644 index 000000000..e5cd5b229 --- /dev/null +++ b/test/scripts/0000-Basic/0627 @@ -0,0 +1,10 @@ +# -be and macro definitions +# +# +exim -be +FOO = bar +baz foo FOO +**** +# +exim -be 'FOO_2 = baz' +**** diff --git a/test/stdout/0627 b/test/stdout/0627 new file mode 100644 index 000000000..75f062f94 --- /dev/null +++ b/test/stdout/0627 @@ -0,0 +1,4 @@ +> Defined macro 'FOO' +> baz foo bar +> +Defined macro 'FOO_2'