Subject: pkg/18856: cyrus-imap pkg: add ability to disable dup elimination.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cgd@netbsd.org>
List: netbsd-bugs
Date: 10/29/2002 23:08:10
>Number:         18856
>Category:       pkg
>Synopsis:       cyrus-imap pkg can't disable duplicate elimination
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 29 15:09:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Chris G. Demetriou
>Release:        1.6 packages
>Organization:
>Environment:
NetBSD 1.6 on shark using pkgsrc tagged netbsd-1-6

>Description:

The NetBSD 1.6 pkgsrc 'cyrus-imap' package (version cyrus-imapd-2.0.16nb1)
does duplicate elimination based on message IDs.  in some cases that's
undesirable.

The documentation discusses disabling duplicate elimination, but according
to the thread culminating in

	http://www.irbs.net/internet/info-cyrus/0201/0243.html

in Cyrus 2.0.x that can only be done by modifying the source.  In that
message a (seemingly-malformed) patch is supplied which adds the ability
to disable dup. elimination via a configuration option, and allegedly
it is "the original patch ... that has been incorporated into 2.1.BETA".

A working version of the patch is included below.

It would be nice if we could have this in our 2.0.x-based cyrus-imap package,
and especially nice if this patch is applied to the 1.6 pkgsrc branch.

>How-To-Repeat:

See above.  Send mail that will be delivered to a machine
running cyrus-imap through two independent channels (e.g.
a mailing list reply sent both to the list and to the original
msg's sender of the message, where the sender is running
cyrus-imap).

Note that two reply messages are rcvd on the original msg sender's
system, but that only one is presented (the other having been
eliminated).

This can produce Special results if you postprocess e-mail based
on headers.

>Fix:

from http://www.irbs.net/internet/info-cyrus/0201/0243.html
and cleaned up so it's actually a valid patch:

--- ./imap/lmtpd.c.BACKUP	Mon Oct 28 23:29:55 2002
+++ ./imap/lmtpd.c	Mon Oct 28 23:30:46 2002
@@ -277,12 +277,14 @@
 	return EC_SOFTWARE;
     }
 
-    /* initialize duplicate delivery database */
-    dupelim = 1;
-    if (duplicate_init(0) != 0) {
-	syslog(LOG_ERR, 
-	       "deliver: unable to init duplicate delivery database\n");
-	dupelim = 0;
+    /* initialize duplicate delivery database if not switched off */
+    dupelim = config_getswitch("duplicateelimination", 1);
+    if (dupelim) {
+        if (duplicate_init(0) != 0) {
+	    syslog(LOG_ERR, 
+	           "deliver: unable to init duplicate delivery database\n");
+	    dupelim = 0;
+        }
     }
 
     /* so we can do mboxlist operations */
--- ./imap/lmtpproxyd.c.BACKUP	Mon Oct 28 23:29:55 2002
+++ ./imap/lmtpproxyd.c	Mon Oct 28 23:31:35 2002
@@ -281,12 +281,14 @@
 	return EC_SOFTWARE;
     }
 
-    /* initialize duplicate delivery database */
-    dupelim = 1;
-    if (duplicate_init(0) != 0) {
-	syslog(LOG_ERR, 
-	       "deliver: unable to init duplicate delivery database\n");
-	dupelim = 0;
+    /* initialize duplicate delivery database if not switched off */
+    dupelim = config_getswitch("duplicateelimination", 1);
+    if (dupelim) {
+        if (duplicate_init(0) != 0) {
+            syslog(LOG_ERR,
+                   "deliver: unable to init duplicate delivery database\n");
+            dupelim = 0;
+        }
     }
 
     /* so we can do mboxlist operations */
--- ./man/imapd.conf.5.BACKUP	Mon Oct 28 23:29:55 2002
+++ ./man/imapd.conf.5	Mon Oct 28 23:32:03 2002
@@ -166,6 +166,11 @@
 If enabled, deliver running in LMTP mode attempts to only write one
 copy of a message per partition and create hard links, resulting in a
 potentially large disk savings.
+.IP "\fBduplicateelimination:\fR yes" 5
+If enabled, the duplicate delivery databases will be initialized and
+processed to avoid the delivery of duplicate messages.  This should
+only switched off for performance reasons.  Disabling the use of the
+duplicate delivery database also disables sieve.
 .IP "\fBreject8bit:\fR no" 5
 If enabled, deliver rejects messages with 8-bit characters in the headers.
 Otherwise, 8-bit characters are changed to `X'.  (A proper soultion to
>Release-Note:
>Audit-Trail:
>Unformatted: