[ mailman-Bugs-851970 ] crash running archiver: StringIO: expected read buffer, list

SourceForge.net noreply at sourceforge.net
Mon Dec 1 04:43:08 EST 2003


Bugs item #851970, was opened at 2003-12-01 20:32
Message generated for change (Comment added) made by mbp
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100103&aid=851970&group_id=103

Category: Pipermail
Group: 2.1 (stable)
Status: Open
Resolution: None
Priority: 5
Submitted By: Martin Pool (mbp)
Assigned to: Nobody/Anonymous (nobody)
Summary: crash running archiver: StringIO: expected read buffer, list

Initial Comment:
Hi,

I'm trying to import some messages into an archive
using the arch command in 2.1.3.  This mostly works,
except that a few messages that seem otherwise
well-formed are causing an exception:

mailman at dp:private$ python -i
/usr/local/mailman/bin/arch distcc /tmp/crash2
#00000 <1066876904.6827.10.camel at lisa.thedoh.com>
Pickling archive state into
/var/mailman/archives/private/distcc/pipermail.pck
Traceback (most recent call last):
  File "/usr/local/mailman/bin/arch", line 187, in ?
    main()
  File "/usr/local/mailman/bin/arch", line 175, in main
    archiver.processUnixMailbox(fp, start, end)
  File
"/usr/local/mailman/Mailman/Archiver/pipermail.py",
line 558, in processUnixMailbox
    a = self._makeArticle(m, self.sequence)
  File
"/usr/local/mailman/Mailman/Archiver/HyperArch.py",
line 626, in _makeArticle
    mlist=self.maillist)
  File
"/usr/local/mailman/Mailman/Archiver/HyperArch.py",
line 255, in __init__    self.__super_init(message,
sequence, keepHeaders)
  File
"/usr/local/mailman/Mailman/Archiver/pipermail.py",
line 216, in __init__    s =
StringIO(message.get_payload())
TypeError: expected read buffer, list found

The problem seems to be that cStringIO (unlike plain
StringIO) cannot take a list as a read buffer.  It will
only accept a string.  

I'm using 
Python 2.2.2 (#1, Jan 30 2003, 21:26:22)
[GCC 2.96 20000731 (Red Hat Linux 7.3 2.96-112)] on linux2

But cStringIO's behaviour seems to be the same even on
Python 2.3.2.

The doc string for pythonlib/email/Message.py's
get_payload() function says

        """Return a reference to the payload.

        The payload will either be a list object or a
string.  If you mutate
        the list object, you modify the message's
payload in place.  Optional
        i returns that index into the payload.

I think this has to be a bug, because if it returns a
list it will certainly break cStringIO.

----------------------------------------------------------------------

>Comment By: Martin Pool (mbp)
Date: 2003-12-01 20:43

Message:
Logged In: YES 
user_id=521

Not only is get_payload() returning a list, but it's not
even a list of strings.  So it's no wonder that StringIO is
having trouble.

For the sample message I quoted, get_payload() returns a
2-element list where the elements are instances of
Mailman.Message.Message.

I wonder if I have an old/buggy pythonlib/email library for
some reason, or if some old cruft on redhat is causing the
problem?  All of the relevant code seems reasonably close to
python 2.3.  And anyhow, the mailman docs say that only
python 2.1 is required.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=100103&aid=851970&group_id=103



More information about the Mailman-coders mailing list