the djb way


qmail at eight

Very soon qmail-1.03 will celebrate its eighth birthday!

Originally released in June 1998, when djb himself was a young lad of 27, qmail has been a remarkably stable and long-lived piece of software.

Some people are bothered by this, though. Especially in America, where traditions are shallow and tiny minds require the constant stimulation of "something new", eight years without a new release is seen as some kind of defect.

We recently encountered comments of this sort at Paul Gregg's blog entry Qmail (sic) is dying.

A common assertion is that somehow qmail is buggy, and the only way it can be run is to apply patches. In this article, we thought we would revisit the subject of qmail patches.

We have a little build system for qmail that works reasonably well. The part where patching happens looks something like this (rc shell syntax):

my_patches=(qmail_local smtpd-blast qmtpd-netstring \
            errno \
            qmailqueue sendmail-f qmtpc)

for(p in $my_patches){
  patch < $PORT/patches/qmail-1.03.$p.patch

So we are up to eight patches here. Doesn't that mean something is wrong with qmail?

Let's break this down.

patch type +lines -lines source files
qmail_local [bug] +1 -1 qmail-local.c
smtpd-blast [bug] +1 -1 qmail-smtpd.c
qmtpd-netstring [bug] +2 -0 qmail-qmtpd.c
errno [port] +1 -3 cdb_seek.c, dns.c, error.h [port] +2 -0 ipme.c
qmailqueue [feat] +14 -3 Makefile, qmail.c
sendmail-f [feat] +34 -0 sendmail.c
qmtpc [feat] +127 -6 qmail-remote.c
total:   +182 -14 11 source files

So, out of the 16,000+ lines of qmail source code, the patches we apply affect about 1.1% of them. And of these, over 96% relate to adding some optional additional features, while less than 4%--only about 7 lines of code--relate to bonafide bugfixes and portability patches.

And strictly speaking, even some of the bug and portability patches aren't really necessary:

As for the "feature" patches, only the qmailqueue patch provides a widely used capability. The largest patch in the patchset, qmtpc, enables connections to remote qmail-qmtpd servers where available --which is practically nowhere. So many will consider this patch a novelty feature, and not worth the bother.

Let's recap the above table.

type number of
% of
combined patch
[bug] 3 +4 2.2%
[port] 2 +3 1.6%
[feat] 3 +175 96.2%
  1. [bug]: to fix a programming error in qmail.
  2. [port]: to compile/run qmail on an "unsupported" platform.
  3. [feat]: to add a feature, capability or extension to qmail.

So here we see that the largest category...

So even after 8 years of intense usage and stress testing, a comprehensive patchset will affect only about 7 lines of code for bug and portability fixes.

qmail seems pretty healthy to us!

Copyright © 2005, Wayne Marshall.
All rights reserved.

Last edit 2005.05.08, wcm.