[exim-dev] [Bug 167] Make "true" and "false" valid expansion…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Philip Hazel
Datum:  
To: exim-dev
Betreff: [exim-dev] [Bug 167] Make "true" and "false" valid expansion conditions
------- You are receiving this mail because: -------
You are the QA contact for the bug.

http://bugs.exim.org/show_bug.cgi?id=167




--- Comment #2 from Philip Hazel <ph10@???> 2007-08-02 09:18:12 ---
On Wed, 1 Aug 2007, Magnus Holmgren wrote:

> I' had trouble seeing the benefit of adding "true" and "false" as trivial
> conditions, taking no arguments.


Note also that Exim expands left to right. You are asking for something
like {$something} to work as a condition if the expansion of $something
is a truth value. The code doesn't work like that. After Exim has read

${if and {{

it looks for one of the known condition names (eq, >, matches, etc) as a
*literal string*. After it has found something it recognizes, it then
knows how many arguments are required, and then it expands each of the
arguments *independently*. Consider

  ${if and {                                    \
           {eq{$something}{true}}               \
           {some other condition}               \
           }                                    \
           {yes string}{no string}}   


It won't expand $something until it has seen "eq", after which it knows
to expect two arguments.

If Exim did any kind of "pre-expansion" it would often be expanding
substrings that it then discarded.

One could implement the literal condition "true" (with zero arguments),
but it would be pretty useless, wouldn't it?

Another way of looking at what I am saying is that Exim doesn't expand
strings twice by default. ... Hmm, you can of course make it do so by
using the "expand" operator. So if you could say

${if true {x}{y}}

then you could also say

${expand: \${if ${lookup...} {yes}{no} }

and if the lookup returned "true" it would work. But is not, IMHO, a
great advance on what you can already do:

${lookup... {${if eq{$value}{true}{yes}{no}} {no} }


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email