procmail
[Top] [All Lists]

Re: ((2^31) -1) scored condition(s) followed by some AND's -- don't work "as expected"

2002-10-13 21:44:06
Parv wrote,

| i thought the following recipe would exit as soon as it hits/scores
| the maximum number, but it doesn't (seem to).

Nor should it.  Reread the procmailsc(5) man page.

| my understanding was...
|
|  1. when either of first 2 conditions are met, mail would go to
|     "i.minolta-junk".
|
|  2. when 1 fails, mail would go to -junk folder when both of last 2
|     conditions are met.

Neither of those is true.

| the recipe...
|
|   Digital_A="\<d(slr|igi(tal)?)"

You'd get the same results with

   Digital_A="\<d(sir|igi)"

but let's get back to what you asked.

|   Digital_B="\<(rant|format|slr|camera|article|minolta|maxxum)"
|   Digital_C="\<(dimage|7[- ]?hi|f[oa]veon|vectis|silicone? film)"
|
|   :0:
|   *   9876543210^0  subj  ??  ()(\<ot\>|off topic|scanner|scan.+elite)

I'm going to assume that you assigned a value to $subj somewhere earlier in
your rcfile.

|   * $ 9876543210^0  B  ??  ()$Digital_C
|   * $               B  ??  ()$Digital_A
|   * $               B  ??  ()$Digital_B
|   In/i.minolta-junk
|
|     :0 E:
|     In/i.minolta

| ..i was expecting procmail to stop at the 2d condition & deliver
| the message to "i.minolta-junk".  instead, the 3d condition
| (unexpected) is also checked, which when fails (as shown in above
| log), mail goes to "i.minolta".

When the score reaches supremum, all remaining WEIGHTED conditions are
skipped.  Unweighted conditions are still tested and must pass.

When the score reaches infemum, the recipe is aborted; all remaining
conditions and the action are skipped.

Why the lack of parallel?  Because, to be brief, it is consistent with the
ANDing of multiple conditions on a recipe.  The net effect of all weighted
conditions is considered one element of the AND, and each unweighted condition
is another element.  They must all pass.

| so my question is when the 2d condition is met, why is the 3d condition
| being checked?

Because it is unweighted.  Now, let's reexamine your two expectations:

| my understanding was...
|
|  1. when either of first 2 conditions are met, mail would go to
|     "i.minolta-junk".

That is wrong.  When condition #1 is met, #2 will be skipped, but #3 and #4
will still be tested and must pass.  When condition #1 fails but #2 is met, #3
and #4 will still be tested.

|  2. when 1 fails, mail would go to -junk folder when both of last 2
|     conditions are met.

If by "when 1 fails" you mean "supposition #1 is not met" -- that is, both
condition #1 and condition #2 fail -- then that is wrong also.  If condition
#1 and condition #2 both fail, then even if #3 and #4 both match, the final
score is zero, so the recipe fails, the action is skipped, and an 'E'lse flag
will get the next recipe a chance.

This will do what I believe you want:

   :0:
   *   9876543210^0  subj  ??  ()(\<ot\>|off topic|scanner|scan.+elite)
   * $ 9876543210^0  B  ??  ()$Digital_C
   * -1^0
   * $ 1^0           B  ??  ()$Digital_A
   * $ 1^0           B  ??  ()$Digital_B
   In/i.minolta-junk

     :0 E:
     In/i.minolta

Now, when the first condition passes, the rest are skipped.  When the first
has failed but the second one passes, the remaining three are skipped.  If the
first two fail, the fourth and fifth must both pass in order to overcome the
third.  Technically you should be able to bail without bothering to look for
$Digital_B if the first two conditions and the test for $Digital_A all fail,
so you might prefer this:

   :0:
   *   9876543210^0  subj  ??  ()(\<ot\>|off topic|scanner|scan.+elite)
   * $ 9876543210^0  B  ??  ()$Digital_C
   * $ -9876543210^0 ! B  ??  ()$Digital_A
   * $ 1^0           B  ??  ()$Digital_B
   In/i.minolta-junk

     :0 E:
     In/i.minolta


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail