procmail
[Top] [All Lists]

unexpected regexp handling - looks like a procmail bug

2002-10-24 23:30:49

* ^Subject:.*\<test(ing)?\>.*(AOL|HTML)

Intended to catch subjects like: "testing AOL send", "test of AOL", etc.

The problem is, it appears that it matches subject like:

"Valve Clearances, Adjustment, and Leakdown Test"

Nothing about the parenthesised text at the end of the argument should appear to be _optional_, so why the heck is this matching? 3.15 and 3.22 both exhibit the same symptom of matching the above subject using that regexp.

If I remove the dot wildcard after the \>, it doesn't mismatch, but then, the regexp isn't the same... If I instead eliminate the \>, likewise it doesn't mismatch.

No Match:

* ^Subject:.*\<test(ing)?\>.*(HTML)
* ^Subject:.*\<test(ing)?\>.*(AOL|HTML)$

Match:

* ^Subject:.*\<test(ing)?\>.*(AOL|HTML)
* ^Subject:.*\<test(ing)?\>.*(AOL|HTML)\>
* ^Subject:.*\<test(ing|)\>.*(AOL|HTML)
* ^Subject:.*\<test(ing|)\>.*(AOL|HTML).*

If I change "AOL" to "gadwdurnit":

* ^Subject:.*\<test(ing)?\>.*(gawdurnit|HTML)

suddenly it seems to work (excepting that it isn't checking for AOL).  If I do:

* ^Subject:.*\<test(ing)?\>.*(AOL|gawdurnit)
* ^Subject:.*\<test(ing)?\>.*(gawdurnit|AOL)

it's broken again.  It's as if the regexp parser doesn't like 'AOL'.

So, I add \/ and emit it in the rule:

* ^Subject:\/.*\<test(ing)?\>.*(AOL|HTML)

Aha - now the log shows the MATCH as including the To: line which FOLLOWS the Subject line - which just so happens to include an AOL address. I double-verified that the test message file has only newlines in it (and there IS one at the end of the Subject: header), no phantom carriage returns. This occurs both if the subject is wrapped and if it isn't.

Further, the wrapper for the test filter includes:

:0
* ^Subject:[    ]*\/[^  ].*
{
        SUBJECT=$MATCH
}

Which is properly extracting ONLY the subject line.


Can someone independantly confirm this?

I don't think I've boffed the regexp - it seems that this is a real bug.
---
 Sean B. Straw / Professional Software Engineering

 Procmail disclaimer: <http://www.professional.org/procmail/disclaimer.html>
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.


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