develooper Front page | perl.perl5.porters | Postings from June 2018

[perl #132360] [PATCH] Fix missing build dependency for pods

From:
Thomas De Schampheleire via RT
Date:
June 10, 2018 16:55
Subject:
[perl #132360] [PATCH] Fix missing build dependency for pods
Message ID:
rt-4.0.24-5587-1528291270-789.132360-15-0@perl.org
On Fri, 27 Oct 2017 18:40:10 -0700, dan.dedrick@gmail.com wrote:
> On Fri, 27 Oct 2017 17:28:22 -0700, jkeenan wrote:
> > On Fri, 27 Oct 2017 00:47:58 GMT, dan.dedrick@gmail.com wrote:
> > > This is a bug report for perl from dan.dedrick@gmail.com,
> > > generated with the help of perlbug 1.40 running under perl 5.27.6.
> > >
> > >
> > > -----------------------------------------------------------------
> > > [Please describe your issue here]
> > >
> > > When building perl with highly parallel options (e.g. -j 32) on a
> > > machine
> > > with many cores (e.g. 32) ocassionaly it fails with the following
> > > type
> > > of error.
> > >
> > > make[1]: Entering directory '.../cpan/podlators'
> > > Can't locate Getopt/Long.pm in @INC (you may need to install the
> > > Getopt::Long module) (@INC contains: .../cpan/AutoLoader/lib
> > > .../dist/Carp/lib .../dist/PathTools .../dist/PathTools/lib
> > > .../cpan/ExtUtils-Install/lib .../cpan/ExtUtils-MakeMaker/lib
> > > .../cpan/ExtUtils-Manifest/lib .../cpan/File-Path/lib .../ext/re
> > > .../dist/Term-ReadLine/lib .../dist/Exporter/lib .../ext/File-
> > > Find/lib
> > > .../cpan/Text-Tabs/lib .../dist/constant/lib .../cpan/version/lib
> > > .../lib ../../lib .) at .../cpan/ExtUtils-
> > > MakeMaker/lib/ExtUtils/Command/MM.pm line 109.
> > > Makefile:445: recipe for target 'manifypods' failed
> > > make[1]: *** [manifypods] Error 2
> > >
> > > The scripts pod2man, pod2text, podchecker, podselect, and pod2usage
> > > all use
> > > Getopt-Long and since they are all part of nonxs modules this needs
> > > to
> > > be
> > > added here to prevent these build races.
> > >
> > >
> >
> > Can you explain a bit more as to what you think is the sequence of
> > events involved in the race condition?
> >
> > Thank you very much.
> 
> If cpan/podlators starts building before cpan/Getopt-Long has finished
> it will attempt to run the pod2man, which contains "require
> Getopt::Long;" before Getopt-Long has been published to the lib dir.
> Therefore when it runs it searches its path and finds no GetOpt-Long
> and fails. This can naturally happen when running a very parallel make
> invocation (-j 32) but it is still fairly rare. It can be artificially
> induced by reordering the nonxs_ext variable such that
> cpan/podlators/pm_to_blib is before cpan/Getopt-Long/pm_to_blib (this
> needs to be done in a fresh workspace right after the Configure is
> run).

I have also seen this problem for perl 5.26.1 on a parallel build with -j33 on a machine with 32 cores.
The issue can be reproduced easily by adding a delay to the handling of Getopt-Long after the Makefile has been generated by the configure step.

--- output/build/host-perl-5.26.1/Makefile	2018-06-06 15:18:34.905011014 +0200
+++ /tmp/Makefile.host	2018-06-06 15:19:01.200009936 +0200
@@ -583,6 +583,11 @@
 	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL) LINKTYPE=static $(STATIC_LDFLAGS)
 
 n_dummy $(nonxs_ext):	$(MINIPERL_EXE) lib/buildcustomize.pl preplibrary FORCE
+	@echo "------- makefile -$@-"
+	@if [ "$@" = "cpan/Getopt-Long/pm_to_blib" ]; then \
+		echo "---- getopt" ; \
+		sleep 60 ; \
+	fi
 	$(MINIPERL) make_ext.pl $@ $(MAKE_EXT_ARGS) MAKE="$(MAKE)" LIBPERL_A=$(LIBPERL)
 
 ext/Pod-Functions/pm_to_blib: cpan/Pod-Simple/pm_to_blib cpan/Pod-Escapes/pm_to_blib pod/perlfunc.pod


With this above reproduction hack, the problem can even be reproduced with '-j5'.

Using the patch provided by Dan Dedrick, the problem is solved.

Could this patch please be applied to official releases?

Thanks,
Thomas

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132360



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