procmail
[Top] [All Lists]

Re: Error when cat'ing file in recipe

2009-06-29 10:21:22
At 22:44 2009-06-29 +1000, Phill Edwards wrote:

   # Replace the body with the ack message
    :0 fbw
    | cat $ACKFILE

Does anyone know why it trying to write to cat?

Because you're telling it to? The 'f' flag is 'filter', and the pipe symbol is the deliver via piping to the program (versus writing to a file). Basically, procmail is writing the original message out to the pipe, and when it comes to realize that cat hasn't READ any of it, it sees that as a write error -- cat will have terminated before all of the message was written to it.

Add the 'i' flag to the recipe to tell procmail to ignore write errors (since you know that cat won't be reading the original body). Read 'man procmailrc' for info.


PPS - Interestingly I get a similar error when it's executing an fgrep command: procmail: Executing "fgrep,-i,-s,someone(_at_)anisp(_dot_)com 06/29/09,ackmail.cache"
    procmail: Error while writing to "fgrep"

Same problem, same solution.

The use of -s there would probably mean you're not using a POSIX.2 grep. POSIX uses -s as "suppress error messages", whereas older implementations of grep used it as "silent" (which would stop reading the file as soon as match was found), which is implemented in POSIX as -q (quiet).

I'd say, you see the error only when the "someone(_at_)anisp(_dot_)com" is found in the message, but not when it isn't (which would force grep to have to scan the entire message to determine it isn't there).

---
 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 homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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