procmail
[Top] [All Lists]

Re: formail -D generates empty msg. when duplicate found?

1999-12-11 16:16:59
I just sent a private reply to Gary, not noticing that he'd also posted.

| Hmmm, ok, but I don't see the benefit of sending through the bogus
| message, and the manpage seems to indicate otherwise:

| I'd read "not output a duplicate message" as meaning "nothing
| will be sent to the output".

But the program after -s is still invoked with the null output as its input.
I have the feeling that formail's -D and -s options were not designed to work
together, and any degree to which they do is lagniappe if not serendipity.

| The problem with sending something through is that it will
| confuse simple scripts like this:
| 
|    formail -D 10000 id.cache -s echo . < mbox | wc -l
| 
| which attempts to count the number of unique messages, but
| will actually count all messages, due to the dummy 'From '
| being passed through.

It's not the dummy From_; there is none, I've come to believe, and that the
dummy postmarks you saw were actually generated by procmail when it saved the
null messages to mboxes without the `r' flag on the recipe.  The problem is
that, even if the message is a duplicate and there is no output, formail -s
still invokes echo.  This would get around that, albeit inelegantly:

   formail -D 10000 id.cache -s < mbox | formail -s echo . | wc -l

or this with somewhat more efficiency, though it's uglier to type, based on a
suggestion from Stephen van den Berg in a similar thread years ago:

  formail -D 10000 id.cache -I'From x' -x'From ' -s < mbox | wc -l

| Also, does a mail message with only "From " line qualify as a valid mail
| message?

It does if there is an empty line before it, or if it is at the very
beginning of the input, or if you are using formail's -e option.

| > | :0 D
| > | * ^From foo(_at_)bar
| > | /dev/null

| As mentioned in a subsequent e-mail, the simple pattern match
| above, didn't appear to work when applied to a message containing
| only a '^From foo(_at_)bar' line - don't know why.

That's additional reason that I'm thinking it's procmail, not formail,
adding the default foo(_at_)bar postmark.  When you run that recipe, procmail
hasn't added it yet, and the message is still empty.