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";