There's something weird going on with procmail, and I'm hoping someone
can explain the internal workings of pipes in procmail so I can
understand exactly why this happens.
The problem is that when I have procmail pipe mail to a filter, short
messages get absorbed by the filter but long messages get delivered to
the mailbox - and I don't want them to. This happens when I use filters
that don't read stdin completely, so clearly it all has something to do
with that. Take for example this lone recipe in a .procmailrc
:0
* .*
| /bin/true
This will pipe all incoming mail to the filter /bin/true, which does not
touch stdin at all. I've tried sending mail to this address with varying
sized messages. With short messages ( < 54 lines ) the mail "disappears"
as I would expect it to. No message ends up getting delivered to the
default mailbox.
But with long messages ( >= 54 lines ) the messages DO get delivered to
the mailbox, and I can't figure out what mechanism is causing that to
happen.
OTOH, if I use a filter action such as "| gzip >> archive.gz" there is no
problem, because gzip does read stdin completely. I have some other auto-
reply scripts that use grep to partially read stdin. Again, with those
scripts, long messages end up getting delivered in their entirety to the
mailbox.
What does procmail do with the pipe/filter's data to stdout? How about
the left over data at stdin? When does it decide it wants to deliver the
message to the mailbox, and when does it just leave the mail with the
filter? Clearly there's a threshold involved, maybe someone can explain
why it works this way.
--
Jem Berkes
http://www.pc-tools.net/
Windows, Linux & UNIX software