procmail
[Top] [All Lists]

Re: procmail: small filters need sleep 1

2004-09-04 23:18:26
The following message is a courtesy copy of an article
that has been posted to comp.mail.misc as well.

DJ> I get procmail: Error while writing to "true".

"D" == David W Tamkin <dattier(_at_)panix(_dot_)com> writes:

D> Yes, of course you do.  true doesn't read the input, so procmail can't
D> write to it, and it reports a write error when it tries to feed a
D> second bufferful to the action but finds the first bufferful wasn't
D> fully (or even partly) read.

D> The reason you get the error only 70% is the time is that 30% of your
D> tests are done on messages with heads so short that they fit into one
D> bufferful, and procmail doesn't try to feed a second bufferful to the
D> action.

I was testing all on the same message.
And then how did the sleep 1 cure it?

D> That's what procmail's `i' flag is for.  It says, "ignore write
D> errors; this command isn't supposed to read all (or maybe any) of the
D> text."

D> Try

D>   :0Whci: vacation.lock
D>   | true

D> and you won't get reports of write errors.

Ok, here's the script I'm staking all my beans on.
I added your "i", but haven't taken out my sleep 1 yet.
Do tell me if I'm still screwing up. Thanks.

#Procmail script that takes effect if we haven't
#logged in for a while, e.g., probably due to a storm.

TYPHOON=yes #Comment this when not worried about typhoons
TYPHOON_CACHE=typhoon.9.2004.cache
LAST_LOGIN_FILE=.spamdealer/time #or .lastlogin etc.
ME=jidanni(_at_)jidanni(_dot_)org
:0 Whci: typhoon.lock
* TYPHOON ?? yes
 # Perform a quick check to see if the mail was addressed to us
* $^To:.*\<$\LOGNAME\>
 # Don't reply to daemons and mailing lists
* !^FROM_DAEMON
 # Mail loops are evil
* !^X-Loop: $ME
|sleep 1 && if test `find $LAST_LOGIN_FILE -mtime +3`;\
  then formail -rD 8192 $TYPHOON_CACHE; fi
#(above we test STRING)

:0 ehc
|(formail -r -IFrom:\ $ME -AX-Loop:\ $ME -IPrecedence:\ junk;\
echo -e I will read your mail after the typhoon power outage.\\n\
Maybe my phone still works, +886-4-25854780.)|$SENDMAIL -oi -t
# Perhaps if -mtime +30:
# echo I must have died. Contact my estate at ....

Can I use three stanzas? ...
|test `find $LAST_LOGIN_FILE -mtime +3`

:0 ahc
|formail -rD 8192 $TYPHOON_CACHE

:0 ehc
|(formail -r ...

____________________________________________________________
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