Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: fschlich [...] zedat.fu-berlin.de
Cc:
AdminCc:

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



Subject: error message when stringifying a studied empty field
Hi, sometimes people don't write anything in their Subject: line. When I $msg->study('subject') and then print (stringify) the result, the error message Use of uninitialized value $decoded[0] in join or string at /usr/share/perl5/Mail/Message/Field/Full.pm line 317 is displayed, even though defaultTrace is set to ERRORS (see attached sample script and mailbox). I would expect this to quietly stringify to an empty string. Florian
Subject: folder.mbox
Download folder.mbox
application/mbox 461b

Message body not shown because it is not plain text.

Subject: stringify.pl
#!/usr/bin/perl -w use strict; use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; Mail::Reporter->defaultTrace('ERRORS'); my $folder = $mgr->open(folder => 'folder.mbox', access => 'rw') or die "cannot open folder.mbox: $!\n"; foreach my $msg ($folder->messages) { my $subject = $msg->study('subject'); print "ok so far\n"; print "Subject is '$subject'\n"; print "(error above)\n"; # WORKAROUND: if (defined $subject && $subject ne '') { # print $subject... } # ... do other stuff ... }
Subject: Re: [rt.cpan.org #66381] error message when stringifying a studied empty field
Date: Sun, 6 Mar 2011 20:03:33 +0100
To: Florian via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Florian via RT (bug-Mail-Box@rt.cpan.org) [110304 17:24]: Show quoted text
> Fri Mar 04 12:24:29 2011: Request 66381 was acted upon. > Transaction: Ticket created by fschlich > Queue: Mail-Box > Subject: error message when stringifying a studied empty field > Broken in: 2.097 > Requestors: fschlich@zedat.fu-berlin.de > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=66381 >
Show quoted text
> When I $msg->study('subject') and then print (stringify) the result, the > error message
The problem is in the parsing. Mail/Message/Field/Full.pm: sub decode($@) { my $self = shift; my @encoded = split /(\=\?[^?]*\?[bqBQ]?\?[^?]*\?\=)/, shift; + @encoded or return ''; my %args = @_; my $is_text = defined $args{is_text} ? $args{is_text} : 1; my @decoded = shift @encoded; The last lines is the cause: when the string is empty, then split will produce an empty @encoded. Show quoted text
> is displayed, even though defaultTrace is set to ERRORS (see attached > sample script and mailbox).
The warning is on Perl level, not reported by MailBox. Setting "no warnings;" whould help. Show quoted text
> I would expect this to quietly stringify to an empty string.
-- Thanks for the nice report! 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 #66381] error message when stringifying a studied empty field
Date: Mon, 7 Mar 2011 15:25:45 +0100
To: Mark Overmeer via RT <bug-Mail-Box [...] rt.cpan.org>
From: Florian Schlichting <fschlich [...] ZEDAT.FU-Berlin.DE>
Hi, On Sun, Mar 06, 2011 at 02:03:49PM -0500, Mark Overmeer via RT wrote: Show quoted text
> sub decode($@) > { my $self = shift; > my @encoded = split /(\=\?[^?]*\?[bqBQ]?\?[^?]*\?\=)/, shift; > + @encoded or return '';
thanks, that fixes the warning Show quoted text
> > is displayed, even though defaultTrace is set to ERRORS (see attached > > sample script and mailbox).
> > The warning is on Perl level, not reported by MailBox. Setting > "no warnings;" whould help.
Ah, I suspected MailBox to mess with the perl warning mechanism somehow... Actually, "use warnings" is set in Mail/Message/Field/Full.pm and would have to be commented out there - at least I didn't have success with just "no warnings;" in my script. There is another, very similar, issue which I'm taking the liberty of tagging on to this bug: See the the attached mbox, opened with the same little script. Here, the Subject: is obviously broken (and this is from an auto-generated bounce message!), so in a way it's ok that there are complaints, but since it's incoming mail that I don't have control over, I don't want to see them and prefer things to be handled on the MailBox side... The messages I get are ok so far Use of uninitialized value $charset in substitution (s///) at /usr/share/perl5/Mail/Message/Field/Full.pm line 272, <GEN1> line 14. Use of uninitialized value $encoding in pattern match (m//) at /usr/share/perl5/Mail/Message/Field/Full.pm line 277, <GEN1> line 14. Use of uninitialized value in subroutine entry at /usr/share/perl5/Mail/Message/Field/Full.pm line 295, <GEN1> line 14. Subject is 'Benachrichtung zum ' (error above) The regular expression on line 309 doesn't match, so _decoder() is called with three undefined values. This should probably be checked for. Florian

Message body is not shown because sender requested not to inline it.

Download smime.p7s
application/x-pkcs7-signature 5.4k

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #66381] error message when stringifying a studied empty field
Date: Thu, 17 Mar 2011 09:22:23 +0100
To: Florian via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Florian via RT (bug-Mail-Box@rt.cpan.org) [110307 14:26]: Show quoted text
> > sub decode($@) > > { my $self = shift; > > my @encoded = split /(\=\?[^?]*\?[bqBQ]?\?[^?]*\?\=)/, shift; > > + @encoded or return '';
Show quoted text
> Use of uninitialized value $charset in substitution (s///) at /usr/share/perl5/Mail/Message/Field/Full.pm line 272, <GEN1> line 14. > Use of uninitialized value $encoding in pattern match (m//) at /usr/share/perl5/Mail/Message/Field/Full.pm line 277, <GEN1> line 14. > Use of uninitialized value in subroutine entry at /usr/share/perl5/Mail/Message/Field/Full.pm line 295, <GEN1> line 14. > Subject is 'Benachrichtung zum ' > (error above)
Both problems got fixed in the version 2.098 which I have just released. -- Thanks for reporting, 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 #66381] error message when stringifying a studied empty field
Date: Thu, 17 Mar 2011 09:32:14 +0100
To: Mark Overmeer via RT <bug-Mail-Box [...] rt.cpan.org>
From: Florian Schlichting <fschlich [...] CIS.FU-Berlin.DE>
On Thu, Mar 17, 2011 at 04:22:40AM -0400, Mark Overmeer via RT wrote: Show quoted text
> Both problems got fixed in the version 2.098 which I have just released.
thank you! Florian
Download smime.p7s
application/x-pkcs7-signature 5.4k

Message body not shown because it is not plain text.

fixed