I have just converted all of our 8000+ users to maildir format. We
don't use qmail but we do use maildir folders using our own MDA.
The mail is delivered in /var/spool/mail/username/

Anyway, shell users now don't have the nice "you have mail" or
"you have new mail" message anymore. So I started checking out the
source code of several shells and mail checkers to see how this
is handled.

It turns out that while in mbox format (see also the mbox(5) manpage
that comes with qmail) it only takes one stat() to find out if new mail
arrived, you need to scan the entire new/ and cur/ directories for
maildir format. With a lot of users who potentially have hundreds
of messages in their spool, this can be quite time- and disk intensive.

Now, with a bit of thinking I found out that this isn't nessecary at
all. The modification time on the tmp/ directory indicates when a new
message was last delivered, since that always goes through tmp/.
The access time on the new/ directory (set by readdir()) indicates when
a mail program last checked the maildir mbox. So, a complete scan
of new/ and cur/ stat()ing all files isn't nessecary at all.

However, since quite a few existing programs take the scanning approach,
they change the access-time on the new/ directory making the above described
approach invalid.

Would it be possible to define the method I decribed above as "the"
method to check for new mail (for shells, status bars etc) and to also
define that programs that actually scan cur/ and new/ should use utime()
to reset the access time on those directories after the scan?

With "the" method I mean the maildir manpage of qmail and djb's webpage
about maildir ..

[If so I could contact the authors of maildir-aware applications to
 make sure they use that method]

Mike.
-- 
Indifference will certainly be the downfall of mankind, but who cares?

Reply via email to