procmail
[Top] [All Lists]

Re: formail failure

2004-04-22 23:50:33
David let me thank you for your quick and very helpful response.

David W. Tamkin wrote:
George has,

    :0 Wf
    * ^Subject:\/.*
    | formail -A "X-Razor2-Status: Spam" -i "Subject: {SPAM}$MATCH"

    :0 WEf
    | formail -A "X-Razor2-Status: Spam" -i "Subject: {SPAM}"


and wrote,

They work fine but if I replace "{" and "}" respectively with "[" and
"]" I get "Error while writing to "formail -A "X-Razor2-Status: Spam" -i
"Subject: [SPAM]$MATCH"".


The left bracket is a character in $SHELLMETAS, so those action lines invoke a shell, even though the bracket is just literal text in them. You can tell that procmail invoked a shell to run the action, because the verbose logfile's line about it leaves the spaces intact instead of converting them to commas.

I thought "[" and "]" are invalid but the
following recipes work as well:

:0 Wf
* ^TO_wrath(_at_)geo\(_dot_)net\(_dot_)ge
| formail -A "X-WRATH: OK" -i "Subject: [WRATH]"

Can anyone tell me what I missed?


It has to be something the shell is doing. What is your setting for $SHELL? If you don't set $SHELL explicitly, procmail uses the shell named for the user in /etc/passwd. My first guess is that your shell is barfing over [SPAM]$MATCH but accepting [SPAM] or [WRATH].

I haven't defined it explicitly so it's /bin/bash (from /etc/passwd). The first thing I have done after failure, I removed the $MATCH from the recipe in question but it failed again. Then I added $MATCH to my 3'rd recipe but it hasn't changed anything.

I'm curious to know what happens if you try this (I'm adding `h' flags because the filtering commands leave the body unchanged anyway):

     :0 Whf # brackets in condition enclose caret, space, tab
     * ^Subject:.*\/[^     ].*
     | formail -A "X-Razor2-Status: Spam" -i "Subject: [SPAM] $MATCH"

     :0 WEhf
     | formail -A "X-Razor2-Status: Spam" -i "Subject: [SPAM]"

The same result, it failed with the same error and I think it's correct because leading spaces/tabs in subject won't change anything, will they?

but this is a better way -- don't call a shell but let procmail invoke formail directly:

     SAVEMETAS=$SHELLMETAS
     SHELLMETAS

     :0 Whf
     * ^Subject:\/.*
     | formail -A "X-Razor2-Status: Spam" -i "Subject: [SPAM]$MATCH"

     :0 WEhf
     | formail -A "X-Razor2-Status: Spam" -i "Subject: [SPAM]"

     SHELLMETAS=$SAVEMETAS


Yes it's better and it works fine.

It still doesn't tell us why your shell is choking; it just evades the issue.

I have left "{" "}" in my recipes because of filters users have set up on workstations but I am happy It's not an emergency workaround, but my choice. Thank you very much for your great input.


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




Best Regards,
--
George Chelidze




_______________________________________________
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>