[tpop3d-discuss]MailDir & status/info tag woes (latest cvs, solaris 9 sparc)

Chris Lightfoot chris at ex-parrot.com
Wed, 31 Mar 2004 23:11:12 +0100


On Wed, Mar 31, 2004 at 05:02:10PM -0500, POP3 daemon mailinglists wrote:
> Hello all,
> 
> A customer is having issues with the latest version of tpop3d marking all
> maildir messages as seen regardless of whether the messages have been
> touched (RETR, TOP, LIST, etc) or not. We are planning on migrating them
> from mbox/vmpop3d to maildir/tpop3d, but this is a showstopper.

-- at present the maildir driver marks all messages as
read when the user logs out. The (arguable) logic for this
is that typical POP3 clients will download all new
messages. I'm prepared to believe that this isn't the most
sensible behaviour!

If you want to patch this locally, search for `Mark
message read' in maildir.c, and comment out the if clause
under that comment.

    [...]
> The ,S=blah tag that you see in the filenames is a file size tag that our
> MTA (Exim, http://www.exim.org/) adds to the filename for quota support.
> This problem occurs with and without that tag present, so that is not the
> cause.
> 
> Another issue we are having is that tpop3d seems to ignore empty info
> fields(:2,), and appends its own. We sometimes manipulate spools using
> perl scripts with the module Mail::Box. This module chooses to add an info
> field to all of the messages even if it has no flags to add, example
> 1080766597.00003.dev,S=1992:2,
> 
> The next time a user logs in and takes any action, even an immediate
> logout, tpop3d appends its own info tag to the filename:
> 1080766597.00003.dev,S=1992:2,:2,S
> 
> Has anyone else run into this issue before? Any help would be greatly
> appreciated.

Hmm. tpop3d assumes that there's no flag on a message in
new/ (it never moves or alters messages not in new/,
except when they are deleted). This is consistent with the
maildir spec:
    http://cr.yp.to/proto/maildir.html
which doesn't consider the possibility of messages in new/
having flags on them, but it's a bit brittle.

For the moment, this patch will solve both problems:

diff -u -r1.24 maildir.c
--- maildir.c   3 Feb 2004 19:52:03 -0000       1.24
+++ maildir.c   31 Mar 2004 22:10:44 -0000
@@ -396,15 +396,6 @@
             if (unlink(m->filename) == -1)
                 log_print(LOG_ERR, "maildir_apply_changes: unlink(%s): %m", m->filename);
                 /* Warn but proceed anyway. */
-        } else {
-            /* Mark message read. */
-            if (strncmp(m->filename, "new/", 4) == 0) {
-                char *cur;
-                cur = xmalloc(strlen(m->filename) + 5);
-                sprintf(cur, "cur/%s:2,S", m->filename + 4); /* Set seen flag */
-                rename(m->filename, cur);    /* doesn't matter if it can't */
-                xfree(cur);
-            }
         }
     }
 

I'll make this more configurable in the next version.

-- 
``... the reason soldiers retire early is that,
  at about age 40 - 45, they realise that war is dangerous.'' (anon.)