develooper Front page | perl.perl5.porters | Postings from September 2013

Re: intermittent failure of cpan/Pod-Simple/t/search50.t

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
September 19, 2013 19:20
Subject:
Re: intermittent failure of cpan/Pod-Simple/t/search50.t
Message ID:
20130919192036.GG66035@plum.flirble.org
On Thu, Sep 19, 2013 at 12:50:42PM +0100, Dave Mitchell wrote:
> The test cpan/Pod-Simple/t/search50.t when run under blead, fails
> once in approximately 572 times when run in perl core.

Thanks for figuring out the why. This had been bugging me.

> I don't really understand whether:
> 
> 1) search50.t has unreasonable expectations;
> 2) Pod::Simple::Search::survey() should be returning 'Pod::perldoc' as the
>     name rather than 'perldoc';

I don't know and I don't know.

> 3) perldoc.pod should be installed as lib/perldoc.pod rather than
>     lib/Pod/perldoc.pod;

Yes, it turns out that it should, but thereby hangs a tale...

> 4) something in the content of perldoc.pod is wrong, and that is confusing
>     Pod::Simple::Search.

No, I think not, on the assumption that the error is (3)

> Independently of that, perhaps that test file should check all pod files
> rather than just one at random, to make errors easier to spot?

I think that it should. Random testing is proving painful. I had assumed that
it was a race condition, not a real failure that was only being sampled every
so often.



Right, so. As best I can work out...

0) Pod-Perldoc really ought to be installing to "site", not "perl", but that
   doesn't actually make a difference for what follows.*
1) I've figured out that ExtUtils::MakeMaker's default scanning code spots
   the perldoc.pod at the top level of cpan/Pod-Perldoc (or any tarball
   unpacked anywhere else), and infers the default install target of
   ../../lib/Pod (or $(INST_LIB)/Pod/perldoc.pod if building outside the core)

   This is how the file ends up copied to lib/Pod/perldoc.pod

2) ./installperl installs non-module Pod files to $Config{privlibexp}/pod
   ie all the files pod/*.pod, and all others mentioned in the relevant block
   in pod/perl.pod, such as cpan/Pod-Perldoc/perldoc.pod
3) it has this line too:

    # ignore pods that are stand alone documentation from dual life modules.
    return if /\.pod\z/ && is_duplicate_pod($_);

   This causes it to ignore lib/Pod/perldoc.pod as a duplicate


Upshot is that the file lib/Pod/perldoc.pod is actually ignored by the entire
build process, and doesn't need to be there


OK, as to a CPAN install. I installed a clean v5.14.0

If I use its CPAN shell to install perlfaq, perlfaq.pod is installed to
the top level of $Config{sitelibexp}. This is earlier on perldoc's search
path, and hence it finds this ahead of the (older) version in
$Config{privlibexp}. So you get to read updated documentation. Win!

If I use its CPAN shell to install current Pod::Perldoc, then (as explained
above), perldoc.pod is installed to $Config{privlibexp}/Pod/perldoc.pod

This isn't *anywhere* on perldoc's search path, so it never finds the new
version:

stat("/home/nick/Sandpit/snap-v5.14.0/bin/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/site_perl/5.14.0/x86_64-linux/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/site_perl/5.14.0/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/5.14.0/x86_64-linux/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/5.14.0/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/5.14.0/pod/perldoc.pod", {st_mode=S_IFREG|0644, st_size=7935, ...}) = 0


I believe that the simplest fix is this:

--- Makefile.PL~        2013-01-29 03:48:57.000000000 +0100
+++ Makefile.PL 2013-09-19 16:24:35.120938102 +0200
@@ -64,4 +64,13 @@
     $path;
 }
 
+sub init_dirscan
+{
+    my($self) = shift;
+    $self->SUPER::init_dirscan;
+    # Need to force perldoc.pod to install at the top level of the lib dir:
+    $self->{PM}{'perldoc.pod'} = $self->catfile($self->{INST_LIB}, 'perldoc.pod');
+    return;
+}
+
 __END__

This causes it to install to $Config{privlibexp}/perldoc.pod, which is on the
search path:

stat("/home/nick/Sandpit/snap-v5.14.0/bin/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/site_perl/5.14.0/x86_64-linux/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/site_perl/5.14.0/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/5.14.0/x86_64-linux/perldoc.pod", 0x7133f0) = -1 ENOENT (No such file or directory)
stat("/home/nick/Sandpit/snap-v5.14.0/lib/perl5/5.14.0/perldoc.pod", {st_mode=S_IFREG|0444, st_size=8448, ...}) = 0


I've pushed this to blead in smoke-me/nicholas/perldoc_not_Pod-perldoc


If people can't spot a flaw in this, I ought to open a ticket on
rt.cpan.org to alert upstream to the problem and the fix.

Nicholas Clark

* It would be nice to have all these modules fixed. I'll volunteer to do it,
  if someone else who wasn't doing it before volunteers to hack on the core
  C code. :-) (ie, it's not the best use of my time if *anyone* else is
  happy to do it)

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About