Re: [exim] issue with ${reduce and ${extract

Top Page
Delete this message
Reply to this message
Author: Phil Pennock
Date:  
To: Victor Ustugov
CC: exim-users
Subject: Re: [exim] issue with ${reduce and ${extract
On 2017-02-26 at 01:37 +0200, Victor Ustugov wrote:
> This example works in exim 4.87.1:
>
> exim -be '${reduce {b}{a aaa}{${extract{1}{ }{$value}} , $item}}'
>
> result:
> a , b
>
> But the same example doesn't work in both exim 4.88 and exim 4.89 RC6.
>
> result:
> , b
>
> There are no any issues with extracting fields from $item.


Confirmed, and "a , b" looks correct to me.

After a couple of abortive looks for likely commits, I used `git bisect`
(as I should have immediately). The start commit is one
known-to-be-good, the run-script is attached:

cp src/scripts/Configure-Makefile ../
git bisect start HEAD 93cc2d6e053031a7008f73ca1ea072038bfa3fc8
git bisect run ../try

--------------------------8< bisect results >8--------------------------
20fcb1e7be45177beca2d433f54260843cc7c2f6 is the first bad commit
commit 20fcb1e7be45177beca2d433f54260843cc7c2f6
Author: ...
Date: Thu Aug 11 20:22:37 2016 +0100

    Defensive coding in ${run }


    Bug 1870


:040000 040000 b7ae717017e95a5effc908fd903b162535ef12bd 53d08a4b8d4f9963d725b776d5aba979edb081de M    src
bisect run success
git bisect run ../try  282.23s user 52.94s system 93% cpu 5:57.58 total
--------------------------8< bisect results >8--------------------------


At this point, I suspect that the issue is the current line 4974 of
expand.c, where `lookup_value = NULL` while skipping, but if
lookup_value was set _before_ skipping, this stomps on it.

-Phil
#!/bin/sh

printf '\x1B[1;32m' ; git describe ; printf '\x1B[0m\n'

cd src
rm -rf build-Darwin-i386

cp -v ../../Configure-Makefile scripts/Configure-Makefile

export PKG_CONFIG_PATH=/usr/local/Cellar/openssl/1.0.2k/lib/pkgconfig:/opt/regexps/lib/pkgconfig
make
ev=$?

git checkout -- scripts/Configure-Makefile

if [ $ev -ne 0 ]; then
    printf >&2 '\x1B[1;33mBUILD FAILURE: make %s [%s]\x1B[0m\n' $? "$(git describe)"
    exit 125
fi


have="$(./build-Darwin-i386/exim -be '${reduce {b}{a aaa}{${extract{1}{ }{$value}} , $item}}')"
want="a , b"

if [ "$have" = "$want" ]; then
    printf >&2 '\x1B[1;32mSUCCESS: %s [%s]\x1B[0m\n' "$have" "$(git describe)"
    exit 0
fi


printf >&2 '\x1B[1;31mFAILURE:\x1B[0m\x1B[31m %s\x1B[0m [%s]\n' "$have" "$(git describe)"
exit 1