procmail
[Top] [All Lists]

RE: Confused by bad var's result

2001-12-17 09:41:18
From: Martin McCarthy

[Dallman wrote:]

The scenario is, I implemented a variable that I thought was defined,
but that was not.  [. . .]

       * $ ^From:[$WS]*SpamCop AutoResponder

[. . . .]
Okay, so with $WS undefined, [why was] the recipe . . . matching on,
for example, all procmail list mail[?]


This is another case where procmail's regular expressions aren't quite
that same as egrep's.

[. . . .]
If $WS is unset then that will be equivalent to:

  * ^From:[]*SpamCop AutoResponder

and if a ']' immediately follows a '[' then it is treated as a literal
square bracket rather than an 'end the character class' metacharacter.
So far so normal.  That expression is then a character class equivalent
to []* aACemnoprs] except for the final square bracket that ends the
character class.  Most regular expression engines would give you an
error because of a missing closing bracket - procmail treats the
end-of-line as an end-of-character-class and doesn't give an error.  I'm
not sure if that is intended behaviour or a bug, but I don't think it is
documented.

So your 'From:' and 'Subject:' conditions are effectively:

   * ^From:[]*SpamCop AutoResponder]
   * ^Subject:[]*SpamCop has accepted]

both contain spaces in the character classes, and From: and Subject:
will both generally be followed by a space, so both those conditions
will match against most mails.

Hope that helps,
Martin

Wow.  Indeed it does!  Muchas gracias, Martin.  I feel a lot
smarter - or at least "educateder" now about wha' happen'.
And now I'll be able more easily to reconstruct from my logs
just whose mail got lost.  :-/

Regards,
dman

-- 
.liam rof moc.moctenTON esu won esaelP  .dedolpmi sah mocteN
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
!ecivres gnidrawrof eerf rof "sdrawrof" liaM  :seimmocteN-xE
.ytitnedi dnarb mocteN s'.cnI ,kniLhtraE htiw detailiffa TON 
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>