Bug#490198: _load_pluggables can fail with hidden error
Joey Hess
joeyh at debian.org
Thu Jul 10 17:15:05 UTC 2008
Package: libcgi-session-perl
Version: 4.32-1
Severity: normal
This bug should be forwarded upstream. Sorry, too lazy to log into PAUSE
myself.
CGI::Session->new will occasionally fail for people like this:
<tschwinge> $ perl -e 'use CGI::Session; use CGI;$s=CGI::Session->new("driver:DB_File;serializer:default;id:static", CGI->new, { Filename => "foo"})'
<tschwinge> Can't locate object method "generate_id" via package "CGI::Session::ID::static" (perhaps you forgot to load "CGI::Session::ID::static"?) at /usr/share/perl5/CGI/Session.pm line 74.
Or this:
<tschwinge> $ perl -e 'use CGI::Session; use CGI;$s=CGI::Session->new("driver:DB_File;serializer:default", CGI->new, { Filename => "foo"})'
<tschwinge> Can't locate object method "generate_id" via package "CGI::Session::ID::" (perhaps you forgot to load "CGI::Session::ID::static"?) at /usr/share/perl5/CGI/Session.pm line 74.
The actual error is not what's shown, but this:
joeyh at gnubber:~$ perl -e 'use CGI::Session::Driver::db_file'
DB_File needs compatible versions of libdb & db.h
you have db.h version 4.6.19 and libdb version 4.6.21
Compilation failed in require at /usr/share/perl5/CGI/Session/Driver/db_file.pm line 8.
BEGIN failed--compilation aborted at /usr/share/perl5/CGI/Session/Driver/db_file.pm line 8.
Compilation failed in require at -e line 1.
This is on a hurd system with some kind of messed up libraries, but that's not
really germane to this bug report.
The bug here is that the error message is useless. In _load_pluggables,
if a module fails to load, it calls:
return $self->set_error("couldn't load $mod_name: " . $msg);
This breaks out of the loop, before other pluggables can be loaded.
Then in new, it does this:
my $id = $self->_id_generator()->generate_id(
$self->{_DRIVER_ARGS},
$self->{_CLAIMED_ID}
);
$self->_id_generator() in turn returns the module name, which has not been
loaded. Splat.
The fix would probably involve testing the return value of load_pluggables
and propigating the error message out so that the caller of new can check it
with errstr().
Until this is fixed, callers of CGI::Session that want to use it robustly
need to eval CGI::Session->new ..
-- System Information:
Debian Release: lenny/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.25-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libcgi-session-perl depends on:
ii perl 5.10.0-11 Larry Wall's Practical Extraction
Versions of packages libcgi-session-perl recommends:
ii libdbi-perl 1.605-1 Perl5 database interface by Tim Bu
-- no debconf information
--
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20080710/3886ddcb/attachment.pgp
More information about the pkg-perl-maintainers
mailing list