procmail
[Top] [All Lists]

Re: formail failure

2004-04-22 08:08:23
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'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]"

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

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


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