[ python-Bugs-996359 ] Bug somewhere in email Parser or PortableUnixMailbox

SourceForge.net noreply at sourceforge.net
Sat Jul 24 21:57:11 CEST 2004


Bugs item #996359, was opened at 2004-07-23 00:53
Message generated for change (Comment added) made by montanaro
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=996359&group_id=5470

Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Skip Montanaro (montanaro)
>Assigned to: Skip Montanaro (montanaro)
Summary: Bug somewhere in email Parser or PortableUnixMailbox

Initial Comment:
When run under Python 2.3 and fed a unix mbox file
on stdin, this script prints the lengths of the messages
in the file and their subjects on stdout:

import sys
import mailbox
import email.Parser

for msg in mailbox.PortableUnixMailbox(sys.stdin, 
email.Parser.Parser().parse):
    print len(str(msg)), msg["subject"]

If run using Python from CVS it prints out "38" as the
length of each message and "None" as the subject.
Something clearly changed between 2.3 and 2.4.
I've not had a chance to dig into the problem yet.
Am I using PortableUnixMailbox or email.Parser.Parser
in some unsupported and now broken way?

Assigning to Barry since he's the obvious email guru,
but anyone can feel free to jump in here.  This would
seem to be a fairly serious bug.

Skip


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

>Comment By: Skip Montanaro (montanaro)
Date: 2004-07-24 14:57

Message:
Logged In: YES 
user_id=44345

Perhaps it's your dumbest mistake yet, but I'm sure I've made dumber. 
;-)

Checked in mailbox.py as v1.43. Also added simple test case to 
test_mailbox.py v1.10.


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

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-07-23 14:20

Message:
Logged In: YES 
user_id=469548

That was my patch, and it was my fault. I forgot to stick
the return calls in the read() and readline() functions. A
patch is unnecessary, I presume? 

This must be my dumbest mistake yet. 

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

Comment By: Skip Montanaro (montanaro)
Date: 2004-07-23 09:22

Message:
Logged In: YES 
user_id=44345

Further investigation shows this simpler script demonstrates
the problem:

import sys
import mailbox

for msg in mailbox.PortableUnixMailbox(sys.stdin):
    print len(str(msg))

Looking at mailbox.py it appears v 1.42 is the culprit. 
Reverting to 1.41
solves the problem.  Reassigning to Andrew since he checked
in that
version.

Skip


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=996359&group_id=5470


More information about the Python-bugs-list mailing list