Skip Menu |

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

Report information
The Basics
Id: 97823
Status: open
Priority: 0/
Queue: Mail-Box

People
Owner: MARKOV [...] cpan.org
Requestors: nigel.metheringham [...] gmail.com
Cc:
AdminCc:

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



Subject: Deep recursion triggered by calling ->string on a message from an IMAP4 mailbox opened rw
I am accessing a mailbox using IMAP4 and pulling the entire message content to parse with a bounce processor. This works fine if the mailbox is opened read only, but fails if the mailbox is opened r/w. If the mailbox is r/w the string method goes into deep recursion:- Deep recursion on subroutine "Mail::Message::Head::string" at /opt/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Mail/Message/Head.pm line 26. Attached test case - credentials stripped. Environment is a perlbrew installation on Mac OS X 10.9.4 - modules are all pretty recent:- $ perl -V [11:11:43] Summary of my perl5 (revision 5 version 20 subversion 0) configuration: Platform: osname=darwin, osvers=13.2.0, archname=darwin-2level uname='darwin weatherwax.local 13.2.0 darwin kernel version 13.2.0: thu apr 17 23:03:13 pdt 2014; root:xnu-2422.100.13~1release_x86_64 x86_64 ' config_args='-de -Dprefix=/opt/perlbrew/perls/perl-5.20.0 -Aeval:scriptdir=/opt/perlbrew/perls/perl-5.20.0/bin' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include', optimize='-O3', cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib libs=-ldbm -ldl -lm -lutil -lc perllibs=-ldl -lm -lutil -lc libc=, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF Built under darwin Compiled at Jun 4 2014 15:39:52 %ENV: PERLBREW_BASHRC_VERSION="0.67" PERLBREW_HOME="/Users/nigel/.perlbrew" PERLBREW_MANPATH="/opt/perlbrew/perls/perl-5.20.0/man" PERLBREW_PATH="/opt/perlbrew/bin:/opt/perlbrew/perls/perl-5.20.0/bin" PERLBREW_PERL="perl-5.20.0" PERLBREW_ROOT="/opt/perlbrew" PERLBREW_VERSION="0.67" @INC: /opt/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/darwin-2level /opt/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0 /opt/perlbrew/perls/perl-5.20.0/lib/5.20.0/darwin-2level /opt/perlbrew/perls/perl-5.20.0/lib/5.20.0 .
Subject: test.pl
#!/usr/bin/env perl use Mail::Box::Manager; my $conn_info = { folder => 'INBOX', server_name => 'imap.server', type => 'Mail::Box::IMAP4', username => 'username', password => 'password', starttls => [ SSL_verify_mode => 'SSL_VERIFY_NONE' ] }; my $mgr_ro = Mail::Box::Manager->new(); my $folder_ro = $mgr_ro->open( %{$conn_info}, access => 'r' ); print length( $folder_ro->message(0)->string ), "\n"; my $mgr_rw = Mail::Box::Manager->new(); my $folder_rw = $mgr_rw->open( %{$conn_info}, access => 'rw' ); print length( $folder_rw->message(0)->string ), "\n";
Should have mentioned that the first stanza in the test file works fine. The second - with access => 'rw' triggers the recursion.
Subject: Re: [rt.cpan.org #97823] Deep recursion triggered by calling ->string on a message from an IMAP4 mailbox opened rw
Date: Thu, 7 Aug 2014 13:00:17 +0200
To: Nigel Metheringham via RT <bug-Mail-Box [...] rt.cpan.org>
From: Mark Overmeer <solutions [...] overmeer.net>
* Nigel Metheringham via RT (bug-Mail-Box@rt.cpan.org) [140807 10:13]: Show quoted text
> Thu Aug 07 06:13:17 2014: Request 97823 was acted upon. > Transaction: Ticket created by NIGELM > Queue: Mail-Box > Subject: Deep recursion triggered by calling ->string on a message > from an IMAP4 mailbox opened rw > > I am accessing a mailbox using IMAP4 and pulling the entire message > content to parse with a bounce processor. This works fine if the mailbox > is opened read only, but fails if the mailbox is opened r/w.
The IMAP4 implementation never got completed in full, because --at the time-- there were far too many bugs in Mail::IMAPClient. I know that there are users of that back-end, I know that there are problems... I have no time nor use IMAP4 myself anywhere. Clearly, the 'load' method is missing from Mail::Box::IMAP4::Head. This should transform that object into a Mail::Message::Head::Complete in a way as ::Head::Delayed does. That Head::Complete object should contain all header lines... not just the headers which are expected (which you can get()) with additional knowledge about order and such. It would take me hours the figure-out how to do that in IMAP4. Maybe I should block the string() method? -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net