procmail
[Top] [All Lists]

Re: procmail multi-line-match in header problem

2006-06-23 09:44:19
On Fri, Jun 23, 2006 at 08:32:09AM -0700, Don Russell wrote:

Justin Piszcz wrote:

I have a procmail rule:

################################################################################
# Save linux-kernel e-mails.
################################################################################
:0
* 
^Return-Path:(_dot_)*linux-kernel-owner(_dot_)*(_at_)vger(_dot_)kernel(_dot_)org*
linux-kernel


However, in some cases, the return path is split-up on three lines, and 
the recipe does not match.
[snip]

Let me take a stab at this....

You could use formail to extract the return-path....

RP = `formail -zx Return-Path: | xargs`
:0 :
* RP ?? (_dot_)*linux-kernel-owner(_dot_)*(_at_)vger(_dot_)kernel(_dot_)org*
linux-kernel

No, that's not needed here.  Nice effort, though. :-)

Procmail expands folded headers when it evaluates conditions.
If Justin's regex isn't matching, it isn't because of the folding.

Also, the asterisk at the end is unnecessary and wrong.
(Okay, in postscript, I now see your point 2 in footnotes.  Good.)
It says "kernel.or" with zero or one or a million or a trillon
"g" chars hung on the end of that.  Leave that asterisk off.
And quote the dots in the regex.  Otherwise, we could match on,
e.g., "vgerikernalsor" (if keeping that asterisk on the end).

I frankly can't remember another time in a dozen years reading
this group that I've seen a stark need for that xargs trick, Don,
besides your odd situation about which we've been posting this
week.  In any case, this isn't such a stellar moment either. :-)

A couple of observations...
1 - you did not specify the : to lock the mailbox (maybe you don't need 
it, but you didn't say you were using maildir instead of mbox
2 - the asterisk at the end is going to match zero or more g characters. 
I don't think that's really what you want.

Correct.

Dallman

____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail