Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Devel-Cover CPAN distribution.

Report information
The Basics
Id: 21009
Status: resolved
Priority: 0/
Queue: Devel-Cover

People
Owner: Nobody in particular
Requestors: cpan [...] clotho.com
Cc:
AdminCc:

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



Subject: Crash when computing pod coverage on a module that does pod parsing
If a program uses Pod::Parser::parse_from_file() internally with an IO::String instance as the receiver, then when Devel::Cover uses that same function later as part of Pod::Coverage computations, it will crash with an IO::String error. Attached are files composing a minimal test case (derived from an actual crash case in Perl::Critic::Violation): Foo.pm is a simple module that invokes Pod::Parser test.pl is a short tester for that module Running via: perl test.pl yields a success Running via: perl -MDevel::Cover test.pl yields the following error: ok 1 - use Foo; ok 2 Can't locate object method "OPEN" via package "IO::String" at /Users/chris/perl/System/Library/Perl/5.8.6/Pod/Parser.pm line 1239. at /Users/chris/perl/System/Library/Perl/5.8.6/Pod/Parser.pm line 1239 Pod::Parser::parse_from_file('Pod::Coverage::Extractor=HASH(0x1a0dbe0)', './Foo.pm', '/dev/null') called at /Users/chris/perl/lib/darwin-thread-multi-2level/Pod/Coverage.pm line 324 Pod::Coverage::_get_pods('Pod::Coverage::CountParents=HASH(0x1a14c70)') called at /Users/chris/perl/lib/darwin-thread-multi-2level/Pod/Coverage/CountParents.pm line 19 Pod::Coverage::CountParents::_get_pods('Pod::Coverage::CountParents=HASH(0x1a14c70)') called at /Users/chris/perl/lib/darwin-thread-multi-2level/Pod/Coverage.pm line 123 Pod::Coverage::coverage('Pod::Coverage::CountParents=HASH(0x1a14c70)') called at /Users/chris/perl/lib/darwin-thread-multi-2level/Pod/Coverage.pm line 197 Pod::Coverage::covered('Pod::Coverage::CountParents=HASH(0x1a14c70)') called at /Users/chris/perl/lib/perl5/site_perl/5.8.6/darwin-thread-multi-2level/Devel/Cover.pm line 1095 Devel::Cover::get_cover('B::CV=SCALAR(0x1a005a8)') called at /Users/chris/perl/lib/perl5/site_perl/5.8.6/darwin-thread-multi-2level/Devel/Cover.pm line 615 Devel::Cover::report() called at /Users/chris/perl/lib/perl5/site_perl/5.8.6/darwin-thread-multi-2level/Devel/Cover.pm line 223 Devel::Cover::last_end() called at test.pl line 0 eval {...} called at test.pl line 0 END failed--call queue aborted. at test.pl line 0
Subject: Foo.pm
package Foo; use Pod::PlainText; use IO::String; sub pod_extract { my $pkg = shift; my $file = shift; my $pod_string = $EMPTY; my $handle = IO::String->new( \$pod_string ); my $parser = Pod::PlainText->new(); $parser->select('DESCRIPTION'); $parser->parse_from_file( $file, $handle ); return $pod_string; } 1; __END__ =head1 NAME Foo =head1 DESCRIPTION blah blah =head1 AUTHOR Me!
Subject: test.pl
use Carp; $SIG{__DIE__} = \&Carp::confess; use Test::More tests => 2; use lib qw(.); use_ok('Foo'); is(Foo->pod_extract('Foo.pm'), <<'EOF'); DESCRIPTION blah blah EOF
Oops, I forgot to provide system information. This is the stock Perl 5.8.6 that comes with MacOSX 10.4, with CPAN modules installed in $HOME/perl Pod::Parser 1.32 Pod::Coverage 0.17 IO::String 1.08 Pod::PlainText 2.02 Devel::Cover 0.58 % perl -V Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level uname='darwin b31.apple.com 8.0 darwin kernel version 8.0.0: sat mar 26 14:15:22 pst 2005; root:xnu-792.obj~1release_ppc power macintosh powerpc ' config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include', optimize='-Os', cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1809)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, 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 ='-L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-ldbm -ldl -lm -lc perllibs=-ldl -lm -lc libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Locally applied patches: 23953 - fix for File::Path::rmtree CAN-2004-0452 security issue 33990 - fix for setuid perl security issues Built under darwin Compiled at Aug 21 2005 17:14:55 %ENV: PERL5LIB="/Users/chris/perl/lib/perl5/site_perl:/Users/chris/perl/lib/perl5:/Users/chris/perl/lib/perl5-core:/Users/chris/perl/lib:/Users/chris/perl/System/Library/Perl:/sw/lib/perl5:/sw/lib/perl5/darwin" PERL5_CPANPLUS_CONFIG="/Users/chris/.cpanplus/config" PERL_CRITIC_CACHE="1" @INC: /Users/chris/perl/lib/perl5/site_perl/5.8.6/darwin-thread-multi-2level /Users/chris/perl/lib/perl5/site_perl/5.8.6 /Users/chris/perl/lib/perl5/site_perl /Users/chris/perl/lib/perl5/darwin-thread-multi-2level /Users/chris/perl/lib/perl5 /Users/chris/perl/lib/perl5-core/5.8.6/darwin-thread-multi-2level /Users/chris/perl/lib/perl5-core/5.8.6 /Users/chris/perl/lib/perl5-core /Users/chris/perl/lib/darwin-thread-multi-2level /Users/chris/perl/lib /Users/chris/perl/System/Library/Perl/5.8.6/darwin-thread-multi-2level /Users/chris/perl/System/Library/Perl/5.8.6 /Users/chris/perl/System/Library/Perl /sw/lib/perl5/5.8.6/darwin-thread-multi-2level /sw/lib/perl5/5.8.6 /sw/lib/perl5 /sw/lib/perl5/darwin /System/Library/Perl/5.8.6/darwin-thread-multi-2level /System/Library/Perl/5.8.6 /Library/Perl/5.8.6/darwin-thread-multi-2level /Library/Perl/5.8.6 /Library/Perl /Network/Library/Perl/5.8.6/darwin-thread-multi-2level /Network/Library/Perl/5.8.6 /Network/Library/Perl /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level /System/Library/Perl/Extras/5.8.6 /Library/Perl/5.8.1 .
I discovered a workaround. If I change Foo.pm's pod_extract() function to the following, the error does not occur. sub pod_extract { my $pkg = shift; my $file = shift; my $pod_string = $EMPTY; my $handle = IO::String->new( \$pod_string ); my $parser = Pod::PlainText->new(); $parser->select('DESCRIPTION'); my $fh; open $fh, '<', $file; $parser->parse_from_filehandle( $fh, $handle ); return $pod_string; } So, the fault appears to lie in Pod::Parser::parse_from_file, but is triggered by Devel::Cover's wrapup code. I've submitted a Pod::Parser bug at http://rt.cpan.org/Ticket/Display.html?id=21010
Subject: Re: [rt.cpan.org #21009] Crash when computing pod coverage on a module that does pod parsing
Date: Sat, 30 Dec 2006 02:46:17 +0100
To: via RT <bug-Devel-Cover [...] rt.cpan.org>
From: Paul Johnson <paul [...] pjcj.net>
On Wed, Aug 16, 2006 at 01:27:32AM -0400, via RT wrote: Show quoted text
> So, the fault appears to lie in Pod::Parser::parse_from_file, but is > triggered by Devel::Cover's wrapup code. > > I've submitted a Pod::Parser bug at > http://rt.cpan.org/Ticket/Display.html?id=21010
This seems to have been fixed in Pod::Parser (it was a my $x if ... problem), so I'll close it here. -- Paul Johnson - paul@pjcj.net http://www.pjcj.net