Re: [Exim] short circuit expansion on conditions

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Nico Erfurth
Date:  
À: Marian Eichholz
CC: exim-users
Sujet: Re: [Exim] short circuit expansion on conditions
Marian Eichholz wrote:
> Hello!
>
> With Exim 4.04 I got a nasty string expansion problem comparing the
> message size with the content of an external file (or a default value).
>
> No, the quota attribute is not usable there.
>
> urmel:~ $ touch /var/exim/spool/t
> urmel:~ $ exim -be '"${if eq{0}{1}{${readfile{t}{}}}{WIRDNIX}}"'
> "WIRDNIX"
> urmel:~ $ rm /var/exim/spool/t
> urmel:~ $ exim -be '"${if eq{0}{1}{${readfile{t}{}}}{WIRDNIX}}"'
> Failed: failed to open t: No such file or directory
>
> This is the problem: "readfile" is evaluated even if a precondition
> fails (like "exists").
>
> I found no hint in the exim-spec, revealing
>
> - if *every* branch is evaluated regardless of preconditions,
> - if there is a way to use short circuit evaluation.
>
> Probably it might be ideal, when unneccessary conditional expansion
> branches are just parsed but not "executed".


This is a known problem, and fixed in the current snapshots.

Exim does no REAL short circuit evaluation, it parses everything, but
just skips the "execution" of the item. And the readfile-operator missed
the check for skipping.

For exim 4.10 you can apply the patch from
http://mail.tmtowtdi.de/exim/exim-4.10-readfile.patch

ciao