Skip Menu |

This queue is for tickets about the Mail-Box CPAN distribution.

Report information
The Basics
Id: 28559
Status: resolved
Priority: 0/
Queue: Mail-Box

People
Owner: Nobody in particular
Requestors: bas [...] debian.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.073
Fixed in: (no value)



Subject: study() on empty headers fails
a study() of a header that is empty (i.e., exists in the mail header, but has no content apart from the header name) results in spurious warnings or even failure. The attached mbox and small perl script demonstrate it. The output I get here is: 1: to-test 2: Use of uninitialized value in print at /tmp/bla.pl line 12, <GEN1> line 10. 3: 4: 5: to-test 6: Use of uninitialized value in print at /tmp/test.pl line 17, <GEN1> line 10. 7: Use of uninitialized value in substitution (s///) at /usr/share/perl5/Mail/Message/Field.pm line 453, <GEN1> line 10. Use of uninitialized value in length at /usr/share/perl5/Mail/Message/Field.pm line 454, <GEN1> line 10. 8: Died at /usr/share/perl5/Mail/Message/Field/Full.pm line 386, <GEN1> line 10. tests 1-4 test a get() on a normal mail header, a non-existing mail header (returns undef, so that's ok), and two empty headers. This all works correctly. tests 5-8 run a study() on the same headers: the first one is ok, the seconds one again return undef, so that's also ok. The third one however results in spurious warnings but seems to correctly return an empty string. The final one results in a failure an the program dying. Is this a bug, or am I overlooking something? Thanks, bas.
Subject: test.pl
#!/usr/bin/perl use strict; use warnings; use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new( access => 'r' ); my $f = $mgr->open( folder => "test.mbox" ); select STDERR; print '1: ', $f->[0]->get("to"), "\n"; print '2: ', $f->[0]->get("no-such-header"), "\n"; print '3: ', $f->[0]->get("reply-to"), "\n"; print '4: ', $f->[0]->get("subject"), "\n"; print '5: ', $f->[0]->study("to"), "\n"; print '6: ', $f->[0]->study("no-such-header"), "\n"; print '7: ', $f->[0]->study("reply-to"), "\n"; print '8: ', $f->[0]->study("subject"), "\n";
Subject: test.mbox
Download test.mbox
application/octet-stream 94b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #28559] study() on empty headers fails
Date: Mon, 30 Jul 2007 20:50:05 +0200
To: "bas [...] debian.org via RT" <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* bas@debian.org via RT (bug-Mail-Box@rt.cpan.org) [070730 14:22]: Show quoted text
> a study() of a header that is empty (i.e., exists in the mail header, > but has no content apart from the header name) results in spurious > warnings or even failure. > > Is this a bug, or am I overlooking something?
No, it's not a bug. Yes it is a bug. As far as I can remember are empty header lines forbidden by the RFCs; so your test is flawed. However, of course we should handle error situations smoothly, so yes it is a bug. I have fixed it in my development version... do you want it? -- MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #28559] study() on empty headers fails
Date: Tue, 31 Jul 2007 00:18:13 +0200
To: Mark Overmeer via RT <bug-Mail-Box [...] rt.cpan.org>
From: Bas Zoetekouw <bas [...] zoetekouw.net>
Hi Mark! You wrote: Show quoted text
> > Is this a bug, or am I overlooking something?
> > No, it's not a bug. Yes it is a bug. > > As far as I can remember are empty header lines forbidden by the > RFCs; so your test is flawed. However, of course we should handle > error situations smoothly, so yes it is a bug.
That makes sense. I actually encountered this when parsing a spam message in a real-life mailbox... Show quoted text
> I have fixed it in > my development version... do you want it?
Yes please. Thanks! Bas. -- Kind regards, +----------------------------------------------------------------------+ | Bas Zoetekouw | Sweet day, so cool, so calm, so bright, | |----------------------------| The bridall of the earth and skie: | | bas@zoetekouw.net | The dew shall weep thy fall tonight; | +----------------------------| For thou must die. | +-----------------------------------------+
Subject: Re: [rt.cpan.org #28559] study() on empty headers fails
Date: Tue, 31 Jul 2007 08:15:35 +0200
To: Bas Zoetekouw via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Bas Zoetekouw via RT (bug-Mail-Box@rt.cpan.org) [070730 22:18]: Show quoted text
> Queue: Mail-Box > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28559 > >
> > I have fixed it in > > my development version... do you want it?
Buiten RT om; volgens mij kunnen we dit nu in het Nederlands doen ;-) Bijgevoegd. -- Met vriendelijke groet, MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Download Mail-Box-2.074.tar.gz
application/x-gunzip 582.4k

Message body not shown because it is not plain text.

fixed in the just released 2.074