Skip Menu |
 

This queue is for tickets about the MIME-tools CPAN distribution.

Report information
The Basics
Id: 11452
Status: resolved
Priority: 0/
Queue: MIME-tools

People
Owner: Nobody in particular
Requestors: nick [...] tenothree.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 5.417
Fixed in: 5.420_01

Attachments


Subject: MIME::Parser: can't flush
Download (untitled) / with headers
text/plain 1.2k
While trying to install the SOAP::Lite module, the tests were breaking because of MIME::Parser. I enclosed the flush method call into an eval block, and everything works great. MIME-tools-5.417 perl 5.8.6 Linux king.to3 2.4.20-8 #1 Thu Mar 13 17:18:24 EST 2003 i686 athlon i386 GNU/Linux [nick@king SOAP-Lite-0.60]$ perl -Mblib t/04-attach.t 1..15 # Running under perl version 5.008006 for linux # Current time local: Thu Feb 10 00:35:11 2005 # Current time GMT: Thu Feb 10 08:35:11 2005 # Using Test.pm version 1.25 Attachment deserialization (Content-ID) test(s)... Something wrong with MIME message: MIME::Parser: can't flush: at /usr/local/lib/perl5/site_perl/5.8.6/MIME/Parser.pm line 789. *** Parser.pm 2005-01-13 11:23:15.000000000 -0800 --- /home/nick/Parser.pm 2005-02-10 00:43:19.000000000 -0800 *************** *** 787,791 **** ### Flush and rewind encoded buffer, so we can read it: ! $ENCODED->flush or die "$ME: can't flush: $!"; $ENCODED->seek(0, 0) or die "$ME: can't seek: $!"; } --- 787,793 ---- ### Flush and rewind encoded buffer, so we can read it: ! undef $@; ! eval { $ENCODED->flush }; ! die "$ME: can't flush: $@" if $@; $ENCODED->seek(0, 0) or die "$ME: can't seek: $!"; }
Download mime_parser.patch
text/x-diff 730b
*** Parser.pm 2005-01-13 11:23:15.000000000 -0800 --- /home/nick/Parser.pm 2005-02-10 00:43:19.000000000 -0800 *************** *** 787,791 **** ### Flush and rewind encoded buffer, so we can read it: ! $ENCODED->flush or die "$ME: can't flush: $!"; $ENCODED->seek(0, 0) or die "$ME: can't seek: $!"; } --- 787,793 ---- ### Flush and rewind encoded buffer, so we can read it: ! undef $@; ! eval { $ENCODED->flush }; ! die "$ME: can't flush: $@" if $@; $ENCODED->seek(0, 0) or die "$ME: can't seek: $!"; }
Download (untitled) / with headers
text/plain 1.8k
On Thu Feb 10 04:03:56 2005, guest wrote: Show quoted text
> While trying to install the SOAP::Lite module, the tests were breaking > because of MIME::Parser. I enclosed the flush method call into an > eval block, and everything works great. > > MIME-tools-5.417 > perl 5.8.6 > Linux king.to3 2.4.20-8 #1 Thu Mar 13 17:18:24 EST 2003 i686 athlon > i386 GNU/Linux > > [nick@king SOAP-Lite-0.60]$ perl -Mblib t/04-attach.t > 1..15 > # Running under perl version 5.008006 for linux > # Current time local: Thu Feb 10 00:35:11 2005 > # Current time GMT: Thu Feb 10 08:35:11 2005 > # Using Test.pm version 1.25 > Attachment deserialization (Content-ID) test(s)... > Something wrong with MIME message: MIME::Parser: can't flush: at > /usr/local/lib/perl5/site_perl/5.8.6/MIME/Parser.pm line 789. > > *** Parser.pm 2005-01-13 11:23:15.000000000 -0800 > --- /home/nick/Parser.pm 2005-02-10 00:43:19.000000000 -0800 > *************** > *** 787,791 **** > > ### Flush and rewind encoded buffer, so we can read it: > ! $ENCODED->flush or die "$ME: can't flush: $!"; > $ENCODED->seek(0, 0) or die "$ME: can't seek: $!"; > } > --- 787,793 ---- > > ### Flush and rewind encoded buffer, so we can read it: > ! undef $@; > ! eval { $ENCODED->flush }; > ! die "$ME: can't flush: $@" if $@; > $ENCODED->seek(0, 0) or die "$ME: can't seek: $!"; > }
The underlying problem is that if you use tmp_to_core, MIME::Parser uses an IO::ScalarArray as a tempfile and tries to flush it. Older versions of IO::ScalarArray didn't set a true return value to flush() and so the code $ENCODED->flush or die "$ME: can't flush: $!"; causes a die(). This has been corrected in later versions of IO::ScalarArray, which now has sub flush { "0 but true" } Just in case anyone else stumbles on this page like I did :-)
Download (untitled) / with headers
text/plain 323b
I suggest that either the prereq list for MIME::Parser should be updated so that it ensures a non-broken flush() method, or a workaround be put in place in process_singlepart() so that it can work with old broken flush()es. Otherwise more people will spend hours tracking down this bug like I just did. Thanks, -Ken
Download (untitled) / with headers
text/plain 104b
Fixed over two years ago in IO-Stringy 2.110. The next release of MIME-tools will require that version.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.