>>>>> "MH" == Marko Hotti <firstname.lastname@example.org> writes:
MH> What is the bottom reason for this?
Who can remember? I think it's always been this way. I think it's broken,
too, which is why the 2.0 code always removes the first match unless you
tell it to remove all matching entries. It will also remove by regex.
And duplicates can occur for other reasons. What 'duplicate' means can
change after the fact by setting mungedomain. This is an interesting
problem, because in 2.0 you don't (just) have mungedomain, you have
user-defined equivalences (aliases) and owner-defined equivalences
(transforms). And a transform can do something like:
which turns email@example.com into firstname.lastname@example.org, and
which turns email@example.com into firstname.lastname@example.org.
They are applied in series. Now, see the problem? The owner can in one
motion make a whole range of addresses equivalent. Safeguards prevent the
user from making things difficult, but it's nigh impossible and not
necessarily desirable to save the owner from himself.
How this is managed is that when you rekey the database (which regenerates
the canonical representation of the address from the stripped address and
the transforms) entries which turn out to be duplicates get eliminated.
(Actually with the text database they're kept around because duplicate keys
don't hurt anything, but other backends need not be so accommodating.)