[Mailman-Users] Possible Bug in 2.1.13 sync_members

Barry Finkel b19141 at anl.gov
Thu Feb 4 16:48:25 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


Mark Sapiro replied:
>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


I applied the patch to 

     /usr/lib/python2.4/email/_parseaddr.py

on my test Mailman system, and I reset the

subscriber list back to its original.  I then ran the same

     /usr/lib/mailman/bin/sync_members

command, and there were no problems: the one subscriber was added,
and the subsequent address lines were not unsubscribed.  I did some RFC
research, and RFC 2822 "Internet Message Format" in section 3.4.1
states:

      Note: Some legacy implementations used the simple form where the
      addr-spec appears without the angle brackets, but included the
      name of the recipient in parentheses as a comment following the
      addr-spec.  Since the meaning of the information in a comment is
      unspecified, implementations SHOULD use the full name-addr form of
      the mailbox, instead of the legacy form, to specify the display
      name associated with a mailbox.  Also, because some legacy
      implementations interpret the comment, comments generally SHOULD
      NOT be used in address fields to avoid confusing such
      implementations.

The same text is in the newer RFC 5322, which obsoletes 2822.  So the
format I am using

     user at example.com   (comments)

SHOULD not be used; the accepted format is

     "comments" <user at example.com>

----------------------------------------------------------------------
Barry S. Finkel
Computing and Information Systems Division
Argonne National Laboratory          Phone:    +1 (630) 252-7277
9700 South Cass Avenue               Facsimile:+1 (630) 252-4601
Building 240, Room 5.B.8             Internet: BSFinkel at anl.gov
Argonne, IL   60439-4828             IBMMAIL:  I1004994



More information about the Mailman-Users mailing list