procmail
[Top] [All Lists]

Re: Dup check, no dumping of message?

1999-11-01 07:42:38
I said these looked equivalent to me and asked whether they really were:

| > LOCKFILE=msgid.lock
| > :0hwf
| > * ? formail -D 8192 msgid.cache
| > | formail -A "X-Duplicate: yeah baby"
| > LOCKFILE # release the regional lock

| > :0Whc:msgid.lock
| > | formail -D 8192 msgid.cache
| >  :0afwh # in case of success (i.e., if it is a duplicate)
| >  | formail -A "X-Duplicate: like, fer sherr"

Philip responded:

| Those recipes differ in four user-visible ways that I can think of:
| 
| 1) The first unneccesarily holds like the lockfile while the header is
|    being added, while the second releases it as soon as the test is done.

Fair enough: advantage to the second method.

| 2) The logfile entries generated when LOGABSTRACT=all will be different
|    when a duplicate comes in.  If VERBOSE=on then the output will differ
|    greatly depending on the recipe.

You mean LOGABSTRACT=all now logs `c'-flag pipe actions again?  As to a
difference in a verbose logfile, that's a given.

| 3) Recipes immeadiately following these will see different results if
|    they use the 'A', 'e', or 'E' flags (interestingly, the 'a' flag will
|    behave identically regardless of which of the above recipes is used.
|    The exact differences seen between the three flags listed above is
|    left as an excercise for the student.)

OK.  That's not a universal advantage to either over the other though,
because if the choice boils down to that factor, some circumstances will
favor one method and some the other.

| 4) "yeah baby" is generally consider less sarcastic than "like, fer sherr"

"Like, fer sherr" was not meant sarcastically there.

| (You may wonder, if I consider lockfile hold-times to be user-*visible*
| what's *in*visible.  Well, the first recipe tries to feed the entire
| message into the "formail -D..." command while the second only feeds the
| header.  Since it'll take one write system call either way, and at most
| one more read system call in formail (but only on message with headers
| greater than BUFSIZ bytes long), I count this as not being user visible.)

If the condition on the first recipe had the "H ??" modifier, then it, too,
would feed only the head to formail -D; I left it out because I wasn't sure
whether it would read the whole message or not without specifying "H ??".