Fix -be macro definition
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 9 Nov 2021 21:23:45 +0000 (21:23 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 9 Nov 2021 21:23:45 +0000 (21:23 +0000)
Broken-by: 753739fdef
doc/doc-txt/ChangeLog
src/src/exim.c
test/confs/0627 [new file with mode: 0644]
test/scripts/0000-Basic/0627 [new file with mode: 0644]
test/stdout/0627 [new file with mode: 0644]

index a5712fce83fc8a6f816c0e76bf8da9bcbfd2b9ca..7f6814d5e906f0f9a5ce28afcd951d0f454d872a 100644 (file)
@@ -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
 -----------------
index a31a8a1b937b54c71c19eaf9f71920a353aed43c..133761de93d236bfb09cc594c7433d0dc49a854c 100644 (file)
@@ -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 (file)
index 0000000..466698a
--- /dev/null
@@ -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 (file)
index 0000000..e5cd5b2
--- /dev/null
@@ -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 (file)
index 0000000..75f062f
--- /dev/null
@@ -0,0 +1,4 @@
+> Defined macro 'FOO'
+> baz foo bar
+> 
+Defined macro 'FOO_2'