I spent a little over an hour tonight trying to solve a bug that was causing the occasional corruption of mail messages sent to me. Once I found what I was looking for, I decided to scribble down a few notes on the problem and potential solutions; I figured that I had been unable to find the solution via search engines, and as a consequence, others may not be able to do so either. Hopefully, now they will. smiley

(The main reason I compiled the following links to solve a procmail bug is because it took me about an hour to figure out, with most of the resources below not appearing in search engines. Hopefully, this page will get indexed, and other people will be able to find these workarounds to the bug quicker.)

On my mailserver, I was noticing an occasional piece of mail that came in corrupted. Given that my mail setup has procmail and spamassassin integrated into it, I figured that one of them was at fault.

The problem I was seeing was that the occasional message would have the first “F” dropped in the From header. (Note that I’m not talking about the “From:” header — the one added by the sender — but rather the very first line of the mailbox, the header with a space after the word “From”.)

My spamassassin log showed the following:

procmail: Program failure (-13) of "spamassassin"
procmail: Rescue of unfiltered data succeeded
 Subject: [censored]

This led me to believe that the problem was with spamassassin, a belief bolstered by this message (and particularly this response) on the procmail mailing list.

Turns out that this is wrong; since that second message, the one wherein the procmail maintainer forcefully denies that his software is to blame, it turns out that the blame has been isolated to his software.

If you experience this bug, you have two potential workarounds and/or solutions as of now. First, you can download the 3.23pre version of procmail, which seems to solve the problem; the portion of code most thought to introduce the bug has been “extensively rewritten” in this prerelease version. Second, you can add the following lines to your .procmailrc file:

:0 fhw
| sed '1s/^rom /From /'

(Note that this second option may not cover all instances where procmail fails with this bug.)