procmail
[Top] [All Lists]

Re: Scoring Function Question

1999-04-14 10:26:36
Ralph Sobek asked,

| If I have the following recipe:
| 
| :0B:
| * 1^1000 H ?? ^\/(From|Subject):.*Condition1
| * 1^1000 ()\/Condition2
| * ! H ?? From:.*Person1
| * ! H ?? From:.*Person2
| | (formail -z ...)
| 
| Will this fail immediately when the two scores each returns 0? 

No.  Procmail doesn't read ahead, so when it finishes the second condition
it doesn't yet know that all the rest of the conditions are going to be
unweighted and that, whether those remaining conditions match or not, there
will be a zero score and the recipe cannot match.  It won't know that until
it reaches the action line.

However, if the score reached infemum (-2147483647), procmail *would* bail
out on the recipe without bothering to read the try of the conditions.

| Or will it still try and test the two From: headers?

It will, but if the first one fails ... that is if the regexp matches and
the condition, being negated, thus fails ... it will bail out then and not
bother testing the second unweighted condition.  BTW, you can combine the
last two conditions:

  * ! H ?? From:.*(Person1|Person2)

Question for the experts: Ralph's example has the `B' flag on the recipe
but three of the four conditions override it with `H ??'; would it be any
more or less efficient to have (or imply) the `H' flag and then override
it with `B ??' for the one condition of the four that looks at the body?