procmail
[Top] [All Lists]

Re: Runaway newlines

2002-06-24 19:48:15
At 02:35 2002-06-25 +0200, Frank de Bot wrote:

I got a weird problem with procmail. I got 2 diffrent script checking email messages. Both return either everything with an extra header or nothing.

Exactly a reason you probably have a problem - if you're using 'f'ilter, and return nothing, your message is now _NOTHING_. Granted, you're filtering the header only. Do your scripts return errorlevels consistent with their emitted text?

 But when I check the size of the inbox of the user, it's 2 bytes big.

Congrats! You do realize that the procmail script you provided does NOTHING directly with the inbox, excepting any default delivery action to it. If either the virus check or the dnsbl scripts end up emitting a blank line instead of anything, this might happen - certainly your delivery recipes which are contingent upon FINDING specific headers won't end up delivering - but nothing message will be lingering around at the end.

It contains 2 newlines. This would cause the mailbox to function inproperly. But I can't figure out what causes these 2 newlines. First I thought one of the script might return those newlines, but I couldn't see any output when I should not and only lots of output when I has to. Maybe something could be wrong in the procmailrc file

I got this .procmailrc file:

I note there's not a single sign of an attempt to use LOGGING, esp. VERBOSE logging. You really should try it. See the many posts recommending it. Also, check into a sandbox (running your script in a test environment) -- see my .sig.

DNSBL = /usr/local/bin/dnsbl.pl
VIRUS = /usr/local/bin/checkvirus.pl
SPAMFILE = /spam.file
LOCKEXT = .lock

:0 fhwb
| $VIRUS $HOME

Since none of us *REALLY* know what your scripts return or what they really do to your message, it's difficult to determine where your problem is without at least an appropriate excerpt from a logfile showing the events.

:0
* ^X-VIRUSCHECK: Found
# well... rejected
/dev/null

Get in the habit of putting comments BEFORE the recipes. Interspersed within them is problematic.

Rather than have the script emit the message with an additional header so that you can toss the whole thing, why not have the script return a true or false result? Same goes for your DNSBL filter.

:0 fhw
| $DNSBL

:0 :headc$LOCKEXT
* ^X-DNSBL: REJECT
| cat >> $HOME/$SPAMFILE

I believe this qualifies as a "useless use of cat". It is also an incorrect use of cat (what exactly are you concatenating? If you're concatenating stdin, then you should be using 'cat -'). Besides that glaring error, there's also the doubling up of slashes (one here between $HOME and $SPAMFILE -- but what does $SPAMFILE start with in your definition?), which might pose problems on some platform or another. Why are you doing it this way instead of say:

:0:
* ^X-DNSBL: REJECT
$HOME/$SPAMFILE


Note that the spamfile isn't your "inbox", so if this is the file that you're seeing getting clobbered, you should clarify that. Otherwise, whatever is left after the two scripts mangle the message is what ends up in your mailbox...

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

<Prev in Thread] Current Thread [Next in Thread>
  • Runaway newlines, Frank de Bot
    • Re: Runaway newlines, Professional Software Engineering <=