Thu, 30 Mar 2006
Old bug hunting
Today I have found and fixed a bug in our POP-3 server which has been there almost since
the Day 1 (5 years or so). Back then I have decided to implement even some of the optional
commands of the POP-3
protocol. One of the commands, UIDL
,
was pretty easy to implement - just one function which returns an unique
message identification for each message (easy as we have the message number
as a primary key in the table of messages), and a wrapper function which
does the protocol part. And here was the problem:
When implementing the UIDL
command, I simply copied the
implementation of the LIST
command, which was almost the same,
it just returns the message size instead of the unique identification.
And the bug was that in the copy I have changed only the part when
the UIDL msg-number
command is handled, and forgot to
modify the part where UIDL
with no arguments (i.e. list of
the whole folder) is handled. So for one message it worked correctly,
but for the whole folder it returned the message sizes instead of unique IDs.
It seems that today's mail clients can be pretty confused when they get
duplicate message IDs in the UIDL
listing...