procmail
[Top] [All Lists]

Re: double negatives

2003-08-12 08:57:31
On Tue, Aug 12, 2003 at 10:34:03AM -0500, David W. Tamkin wrote:
Scott Wiersdorf wondered,

I'm not sure how procmail will interpret something like this:

   * $ -${MAXSPAM}^0

when MAXSPAM is -6.3 (i.e., double negative), for example.

It doesn't apply here -- MAXSPAM couldn't logically be less than
zero -- 

Maybe we're not talking about the same thing. Your message just scored
(for example):

    X-Spam-Status: No, hits=-5.1 required=5.0

which would cause my recipe to fail, since MAXSPAM now contains a
negative number. I suppose another check in there for a negative
MAXSPAM would be best:

    :0
    * $MAXSPAM^0
    { IS_NEGATIVE=0 }
    
    :0E
    { IS_NEGATIVE=1 }

but I had reason to try subtracting a possibly negative value in another 
use a few years ago.

Procmail expands the variable first and then decides that anything 
containing "--" is not a number, so you get an error.

That's what I was afear'd of.

Here is a working method for subtracting a value of either sign:

 * $ $variable^-2 HOST ?? ^^.|.^^

David, would you mind explaining what this is doing? I follow most of
it, but the

    HOST ?? ^^.|.^^

is unexpected. What does this do? I'm unsure how to read it:

    "HOST begins with a character OR ends with a character"

is that correct? How does this fit in with subtracting the negative
score?

OK, it requires that $HOST be at least two characters long, but is it 
ever not?

I've seen hosts that were not FQDN and just had the hostname part
(mine is 'db' for example), so I suppose it would be possible someone
could have their hostname set to 'a' or something shorter than to
chars, but unlikely.

Scott
-- 
Scott Wiersdorf
scott(_at_)perlcode(_dot_)org

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