Skip Menu |

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

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

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

Bug Information
Severity: (no value)
Broken in: 2.090
Fixed in: (no value)



Subject: threadStart() chokes on dummy messages in thread
I can't rule out this is just because I'm using threadStart() in a wrong way, but then my code works flawlessly on all but 2-3 out of 50.000 messages. From my glances at the module code, I'd say it should never call $thread->message->timestamp on a Mail::Message::Dummy, but that's exactly what seems to happen: [15:47] newsadm@Trinidad:~/tmp/fschlich/mail__box/archivertest$ ../archiver.pl archiver.mbox DEBUG: 9e5625740808020105t7c05a7fm3ecff68b303fd392@mail.gmail.com ERROR: You cannot take the head of a dummy message Can't call method "recvstamp" on an undefined value at /usr/share/perl5/Mail/Message.pm line 259, <GEN3> line 18 (#1) (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an undefined value. Something like this will reproduce the error: $BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "recvstamp" on an undefined value at /usr/share/perl5/Mail/Message.pm line 259, <GEN3> line 18. Mail::Message::timestamp('Mail::Message::Dummy=HASH(0x8837878)') called at /usr/share/perl5/Mail/Box/Thread/Manager.pm line 147 Mail::Box::Thread::Manager::threadStart('Mail::Box::Thread::Manager=HASH(0x87f5a88)', 'Mail::Box::Mbox::Message=HASH(0x87f31f4)') called at ../archiver.pl line 30 Please find my code (archiver.pl) and an mbox with a stripped-down version of an offending message (archiver.mbox) attached. Florian
Subject: archiver.mbox
Download archiver.mbox
application/octet-stream 569b

Message body not shown because it is not plain text.

Subject: archiver.pl
#!/usr/bin/perl -w use Mail::Box::Manager; use strict; use diagnostics; # archiver.pl # walks over new messages, and if a tag can be identified, archive the whole thread $|=1; my $seen_file = 'seen.mbox'; my $new_file = $ARGV[0]; (-s $new_file) || die "can't find $new_file -- is it an mbox?\n"; my $mgr = Mail::Box::Manager->new; my $seen_folder = $mgr->open(folder => $seen_file, access => 'rw', create => 1) or die "cannot open folder $seen_file: $!\n"; my $new_folder = $mgr->open(folder => $new_file, access => 'rw') or die "cannot open folder $new_file: $!\n"; my $threads = $mgr->threads(folders => [$seen_folder,$new_folder]); # examine new mail in turn foreach my $newmsg ($new_folder->messages) { next if $newmsg->isDeleted or $newmsg->isDummy; print "DEBUG: ", $newmsg->messageId, "\n"; # find the start of the thread this new message is in my $threadstart = $threads->threadStart($newmsg); print "DEBUG: ...not reached...\n"; # take alle messages in thread my @thread = $threadstart->threadMessages; my %tags = (); # examine thread starting from last message while (my $msg = pop @thread) { my $subject = $msg->head->study('subject'); if ($subject) { # spam might not have a subject... $subject = $subject->decodedBody(); # ?iso-88..? in subject... while ($subject =~ /\[(\d+)\]/g) { $tags{$1} = 1; } #... } # test BODY # ... # stop if we've found a tag last if (scalar keys %tags); } # save result }
Subject: Re: [rt.cpan.org #40347] threadStart() chokes on dummy messages in thread
Date: Fri, 7 Nov 2008 13:53:13 +0100
To: Florian via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
Sorry for the delay in the responses, but my program was far too full with obligatory activities in the previous two weeks :( * Florian via RT (bug-Mail-Box@rt.cpan.org) [081024 15:15]: Show quoted text
> Fri Oct 24 10:15:16 2008: Request 40347 was acted upon. > Transaction: Ticket created by fsfs > Queue: Mail-Box > Subject: threadStart() chokes on dummy messages in thread
Show quoted text
> Can't call method "recvstamp" on an undefined value at > /usr/share/perl5/Mail/Message.pm line 259, <GEN3> line 18. > Mail::Message::timestamp('Mail::Message::Dummy=HASH(0x8837878)') > called at /usr/share/perl5/Mail/Box/Thread/Manager.pm line 147
Quite a serious bug. Don't know why my regression tests did not catch it. Anyway: Mail/Box/Thread/Manager.pm foreach ($self->folders) - { last unless $_->scanForMessages + { my $message = $thread->message; + my $timespan = $message->isDummy ? 'ALL' + : $message->timestamp - $self->{MBTM_timespan}; + + last unless $_->scanForMessages ( $thread->messageId , $parent->messageId - , $thread->message->timestamp - $self->{MBTM_timespan} + , $timespan , $self->{MBTM_window} ); } -- Regards, 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 #40347] threadStart() chokes on dummy messages in thread
Date: Fri, 14 Nov 2008 17:58:27 +0100
To: Mark Overmeer via RT <bug-Mail-Box [...] rt.cpan.org>
From: Florian Schlichting <fschlich [...] CIS.FU-Berlin.DE>
Show quoted text
> Sorry for the delay in the responses, but my program was far too > full with obligatory activities in the previous two weeks :(
no need to apologize, I know what you mean Show quoted text
> > Can't call method "recvstamp" on an undefined value at > > /usr/share/perl5/Mail/Message.pm line 259, <GEN3> line 18. > > Mail::Message::timestamp('Mail::Message::Dummy=HASH(0x8837878)') > > called at /usr/share/perl5/Mail/Box/Thread/Manager.pm line 147
> > Quite a serious bug. Don't know why my regression tests did not > catch it. Anyway: Mail/Box/Thread/Manager.pm > > foreach ($self->folders) > - { last unless $_->scanForMessages > + { my $message = $thread->message; > + my $timespan = $message->isDummy ? 'ALL' > + : $message->timestamp - $self->{MBTM_timespan}; > + > + last unless $_->scanForMessages > ( $thread->messageId > , $parent->messageId > - , $thread->message->timestamp - $self->{MBTM_timespan} > + , $timespan > , $self->{MBTM_window} > ); > }
hmm, this seems to work at first sight, but throwing more stuff at it I'm getting more error messages and I'm unable for the moment to isolate a single message that would trigger the error: an't call method "get" on an undefined value at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.4//Mail/Box/Thread/Manager.pm line 308, <GEN4> line 45708 (#1) (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an undefined value. Something like this will reproduce the error: $BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "get" on an undefined value at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.4//Mail/Box/Thread/Manager.pm line 308, <GEN4> line 45708. at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.4//Mail/Box/Thread/Manager.pm line 308 Mail::Box::Thread::Manager::_process_delayed_message('Mail::Box::Thread::Manager=HASH(0x8c1c964)', 'Mail::Box::Thread::Node=HASH(0x95324d4)', 'Mail::Box::Mbox::Message=HASH(0x96f5924)') called at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.4//Mail/Box/Thread/Manager.pm line 294 Mail::Box::Thread::Manager::_process_delayed_nodes('Mail::Box::Thread::Manager=HASH(0x8c1c964)') called at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.4//Mail/Box/Thread/Manager.pm line 98 Mail::Box::Thread::Manager::thread('Mail::Box::Thread::Manager=HASH(0x8c1c964)', 'Mail::Box::Mbox::Message=HASH(0x8c87334)') called at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.4//Mail/Box/Thread/Manager.pm line 137 Mail::Box::Thread::Manager::threadStart('Mail::Box::Thread::Manager=HASH(0x8c1c964)', 'Mail::Box::Mbox::Message=HASH(0x8c87334)') called at ./archiver-patch.pl line 34 perhaps you'll have an idea, otherwise I can do more testing when I'm back Florian
Probably resolved
Subject: Re: [rt.cpan.org #40347] threadStart() chokes on dummy messages in thread
Date: Thu, 18 Dec 2008 14:10:01 +0100
To: Mark Overmeer via RT <bug-Mail-Box [...] rt.cpan.org>
From: Florian Schlichting <fschlich [...] CIS.FU-Berlin.DE>
On Thu, Dec 11, 2008 at 06:50:18AM -0500, Mark Overmeer via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=40347 > > > Probably resolved
I was trying to verify that this is indeed the case, but I'm completely baffled at what might be an entirely different problem. Using Mail-Box-2.086 and Files attached to this bug a month ago: [14:07] newsadm@Trinidad:~/tmp/fschlich/mail__box/archivertest/Dezember$ ./archiver.pl archiver.mbox DEBUG: 9e5625740808020105t7c05a7fm3ecff68b303fd392@mail.gmail.com DEBUG: ...not reached... [14:07] newsadm@Trinidad:~/tmp/fschlich/mail__box/archivertest/Dezember$ cd .. [14:07] newsadm@Trinidad:~/tmp/fschlich/mail__box/archivertest$ Dezember/archiver.pl Dezember/archiver.mbox DEBUG: 9e5625740808020105t7c05a7fm3ecff68b303fd392@mail.gmail.com Can't call method "timestamp" on an undefined value at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.8/Mail/Box.pm line 612, <GEN3> line 18 (#1) (F) You used the syntax of a method call, but the slot filled by the object reference or package name contains an undefined value. Something like this will reproduce the error: $BADREF = undef; process $BADREF 1,2,3; $BADREF->process(1,2,3); Uncaught exception from user code: Can't call method "timestamp" on an undefined value at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.8/Mail/Box.pm line 612, <GEN3> line 18. at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.8/Mail/Box.pm line 612 Mail::Box::scanForMessages('Mail::Box::Mbox=HASH(0x883a308)', 'Pine.SGI.4.61.0808012054590.87611576@Waran.CIS.FU-Berlin.DE', '9e5625740807311424o6916c69t6a6be62224182fe0@mail.gmail.com', 'ALL', 10) called at /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.8/Mail/Box/Thread/Manager.pm line 151 Mail::Box::Thread::Manager::threadStart('Mail::Box::Thread::Manager=HASH(0x84b9794)', 'Mail::Box::Mbox::Message=HASH(0x88b0e84)') called at Dezember/archiver.pl line 33 HOW CAN THAT POSSIBLY HAPPEN?! I didn't "make" with a relative prefix, and where else could relative paths matter? It seems the error persists when going higher up in the directory tree, but when trying the same further down, it works nicely... what am I missing? Florian
Subject: Re: [rt.cpan.org #40347] threadStart() chokes on dummy messages in thread
Date: Tue, 30 Dec 2008 20:16:39 +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) [081218 13:10]: Show quoted text
> Queue: Mail-Box > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=40347 > > > On Thu, Dec 11, 2008 at 06:50:18AM -0500, Mark Overmeer via RT wrote:
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=40347 > > > > > Probably resolved
> > I was trying to verify that this is indeed the case, but I'm completely > baffled at what might be an entirely different problem. Using > Mail-Box-2.086 and Files attached to this bug a month ago: > > Can't call method "timestamp" on an undefined value at > /server/newsadm/tmp/fschlich/mail__box/perl/share/perl/5.8.8/Mail/Box.pm line 612, <GEN3> line 18 (#1)
Show quoted text
> what am I missing?
That part of Mail::Box was probably never used for serious things. Add : !$startmsg ? 0 before line 612.... -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
fixed in 2.085
another addendum: your suggested amendment to Mail/Box.pm: : !$startmsg ? 0 does indeed fix my problem. It never made it into Mail::Box, though (as per 2.090). Could you please add it? I think it's around line 592 now. Thanks!
I tend to wait for response whether the suggested fixes work. included for 2.91