Re: [exim] Help to logical OR two conditions

Top Page
Delete this message
Reply to this message
Author: Mike Brudenell
Date:  
To: Exim Users
Subject: Re: [exim] Help to logical OR two conditions
Having had a chat with Victor off-list, I think the thing he's curious
about is why *or* *requires* strict true/false values as its arguments, but
the *condition* condition *doesn't* — instead *condition* effectively
performs a *bool_lax* on the expression evaluated on its right hand side.
This difference is documented within the description of bool_lax in the
String Expansions chapter, but is easy to miss for people new to Exim

I suggested that strictly requiring true/false within an *or* is likely a
safety measure, otherwise it's very easy to write expressions that appear
to work but don't in all situations because of the lenient interpretation.

I think there was also some confusion over the Expansion Items, Expansion
Operators, Expansion Conditions and Combination Conditions. From the
developers perspective these are different types of thing, that are can be
used in different ways/places. But for a newcomer to Exim it can be
confusing. For example,

- A *condition* condition wants a true/false value
- An *or* returns a Boolean true/false value
- But (if memory serves, I no longer run the mail service here so don't
have access now to the test system) you can't write
condition = or{ {<cond1>} {<cond2} }
- Instead you need to wrap the *or* up within an *if*
- The *if* can potentially return any string, which an implicit
*bool_lax* then makes into a Bolean true/false acceptable to the
*condition*.


So one can gradually learn that *condition* is happy to interpret the empty
string and "no", "false" and 0 as a Boolean false, with everything else
meaning true, and then assume that in other places where true/false values
are wanted you can do likewise. But in fact you can't, because most places
instead want a strict Boolean true/false, and you therefore need to
manually add the *bool_lax* (which you don't for *condition*).
😵

I'm guessing this has come about because of the evolution of Exim over the
years and needing to maintain compatibility with previous
version's configuration files, which is fine and something long-term users
understand and accept.

Cheers,
Mike B-)

On Sun, 4 Oct 2020 at 11:56, Jeremy Harris via Exim-users <
exim-users@???> wrote:

> On 04/10/2020 08:30, Victor Sudakov via Exim-users wrote:
> > Jeremy Harris via Exim-users wrote:
> >> On 03/10/2020 15:18, Victor Sudakov via Exim-users wrote:
> >>> And why did they call bool{...} and friends "Expansion conditions"
> >>> while they are clearly not conditions, but operators?
> >>
> >> The operate on things and result in conditionals. Have to call
> >
> > What you do mean by "result in conditionals" ? They result in boolean
> > values.
>
> Those are the same.
> --
> Cheers,
> Jeremy
>
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/
>



--
*My normal working days are Tuesdays, Wednesdays and Thursdays.*

Systems Administrator working in Teaching & Learning
IT Services, University of York, Heslington, York YO10 5DD, UK
Tel: +44-(0)1904-323811
Email Disclaimer: www.york.ac.uk/about/legal-statements/email-disclaimer/

Web: www.york.ac.uk/it-services
Disclaimer: www.york.ac.uk/docs/disclaimer/email.htm