Bug#401144: Timeout and external Socket don't cooperate (+trivial fix)

Alexander Zangerl az at debian.org
Fri Dec 1 06:17:53 CET 2006


Package: libmail-imapclient-perl
Version: 2.2.9+deb-2
Severity: normal


If one passes the IMAPClient constructor an external Socket
(eg. when an SSL connection with extra settings is desired), then
the constructor doesn't properly set things up. This fouls operations 
if and only if the Timeout parameter is also used, because
the select/timeout code then attempts to access a nonexistent select
fdset.

There's a simple workaround: after making the IMAPClient object, 
run $yourobject->Socket($yoursocket). This seems superfluous
(as we can pass the Socket in the constructor more conveniently), 
but isn't.

What is going on and how to fix it?
In new(), lines 221++, the parameter values are directly chucked into
the object hash. If connect() would be run (ie. not in our case),
the connection is opened and the _do_accessor() is run for Socket
and this fellow sets up the _select fdset.
But as we pass the external Socket, the _do_accessor() is never run, which
leaves us with no $self->{_select}, which makes the first real operation 
bomb with the message 
---
Can't call method "can_read" on an undefined value 
	at /usr/share/perl5/Mail/IMAPClient.pm line 1583.
---	

A fix would be to add 
	$self->Socket($self->{Socket}) if ($self->{Socket});
between lines 235 and 236.

(BTW, a short check of the version in testing shows 
that the same problem is present there.)

regards
az


-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (980, 'testing'), (970, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.18
Locale: LANG=C, LC_CTYPE=de_AT (charmap=ISO-8859-1)

Versions of packages libmail-imapclient-perl depends on:
ii  libparse-recdescent-perl   1.94-4        Generates recursive-descent parser
ii  perl                       5.8.4-8sarge5 Larry Wall's Practical Extraction 

-- no debconf information




More information about the pkg-perl-maintainers mailing list