[exim-dev] [Bug 2061] Initial $value in reduce being erased

Top Page
Delete this message
Reply to this message
Author: admin
Date:  
To: exim-dev
Subject: [exim-dev] [Bug 2061] Initial $value in reduce being erased
https://bugs.exim.org/show_bug.cgi?id=2061

Git Commit <git@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |git@???


--- Comment #2 from Git Commit <git@???> ---
Git commit:
https://git.exim.org/exim.git/commitdiff/9e09521e621d852ac4828f1865b4ccb01568d9ee

commit 9e09521e621d852ac4828f1865b4ccb01568d9ee
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Feb 26 01:07:47 2017 +0000
Commit:     Jeremy Harris <jgh146exb@???>
CommitDate: Sun Feb 26 13:22:31 2017 +0000


    Fix ${extract } corrupting an enclosing ${reduce }  $value.  Bug 2061


    Broken-by: 20fcb1e7be45   - Bug 1870
---
 src/src/expand.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)


diff --git a/src/src/expand.c b/src/src/expand.c
index 6257c28..f85ee49 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -3194,17 +3194,17 @@ items. */
 while (isspace(*s)) s++;
 if (*s == '}')
   {
-  if (!skipping)
-    if (type[0] == 'i')
-      {
-      if (yes) *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true",
4);
-      }
-    else
-      {
-      if (yes && lookup_value)
-    *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value);
-      lookup_value = save_lookup;
-      }
+  if (type[0] == 'i')
+    {
+    if (yes && !skipping)
+      *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4);
+    }
+  else
+    {
+    if (yes && lookup_value && !skipping)
+      *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value);
+    lookup_value = save_lookup;
+    }
   s++;
   goto RETURN;
   }
@@ -5801,11 +5801,12 @@ while (*s != 0)
       processing for real, we perform the iteration. */


       if (skipping) continue;
-      while ((iterate_item = string_nextinlist(&list, &sep, NULL, 0)) != NULL)
+      while ((iterate_item = string_nextinlist(&list, &sep, NULL, 0)))
         {
         *outsep = (uschar)sep;      /* Separator as a string */


-        DEBUG(D_expand) debug_printf_indent("%s: $item = \"%s\"\n", name,
iterate_item);
+    DEBUG(D_expand) debug_printf_indent("%s: $item = '%s'  $value = '%s'\n",
+              name, iterate_item, lookup_value);


         if (item_type == EITEM_FILTER)
           {


--
You are receiving this mail because:
You are on the CC list for the bug.