[Mailman-Users] Possible Bug in 2.1.13 sync_members

Mark Sapiro mark at msapiro.net
Thu Feb 4 01:52:38 CET 2010


>Barry Finkel wrote:
>>
>>I ran a test with a test list on my test virtual machine, and this is
>>what is happening.  The line in the "-f" file for sync_members
>>
>>     bsf-crane at example.com          (New 1 (zzz))
>>
>>is causing all of the succeeding lines in that file to be treated as
>>part of the parenthesized "name-comments" field for this new
>>bsf-crane entry.  The command


Yes, I am able to duplicate this issue with email 3.0.1
Utils.getaddresses(), but only if the input file is 'unix format'
(<LF> line terminators and only if the succeeding lines also have the
'name' in a comment. If the file is 'dos format' - i.e. <CRLF> line
terminators, the problem does not occur. Also, I don't think it occurs
with email 4.0.1 with either input format. And if there are lines of
the form "Display Name <user at example.com>", the first of those and the
subsequent lines will be OK.

The underlying problem is in the _parseaddr module in the email package
which misses the second paren when a nested comment and the outer
comment terminate together

As a workaround, for sync_members, you could try the following. Find
this section

    # strip out lines we don't care about, they are comments (# in first
    # non-whitespace) or are blank
    for i in range(len(filemembers)-1, -1, -1):
        addr = filemembers[i].strip()
        if addr == '' or addr[:1] == '#':
            del filemembers[i]
            print _('Ignore  :  %(addr)30s')

add three lines so it becomes

    # strip out lines we don't care about, they are comments (# in first
    # non-whitespace) or are blank
    for i in range(len(filemembers)-1, -1, -1):
        addr = filemembers[i].strip()
        if addr == '' or addr[:1] == '#':
            del filemembers[i]
            print _('Ignore  :  %(addr)30s')
        else:
            # work around bug in email 3.0.1 Utils.getaddresses()
            filemembers[i] = addr + '\r\n'

The better fix is the attached _parseaddr.patch.txt for the 3.0.1
email/_parseaddr.py

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: _parseaddr.patch.txt
URL: <http://mail.python.org/pipermail/mailman-users/attachments/20100203/08121654/attachment.txt>


More information about the Mailman-Users mailing list