This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Get ‘./miniperl -Ilib -T’ working
authorFather Chrysostomos <sprout@cpan.org>
Sun, 31 Aug 2014 20:11:03 +0000 (13:11 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 31 Aug 2014 21:12:35 +0000 (14:12 -0700)
If the first directory included via -I contains buildcustomize.pl,
then miniperl will try to load it at startup.  This allows the build
process to access all the necessary directories, because
buildcustomize.pl fills in @INC.

This was not working under taint mode, making it a pain for me to
diagnose tainting bugs with miniperl (which builds faster than perl
proper, obviously).

It failed because buildcustomize.pl is loaded with generated code that
does ‘do "lib/buildcustomize.pl"’ (where ‘lib’ is taken from -Ilib),
but do-file searches @INC, which does not include the current direc-
tory under taint mode.

The easiest solution here is to add ‘./’ to the beginning of the path.
It is unlikely that anyone is using miniperl -I/... (with an absolute
path), and miniperl is only supposed to be used for building or devel-
oping perl, anyway.

perl.c

diff --git a/perl.c b/perl.c
index 8df24db..4af5348 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2070,7 +2070,9 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
                it should be reported immediately as a build failure.  */
            (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
                                                 Perl_newSVpvf(aTHX_
                it should be reported immediately as a build failure.  */
            (void)Perl_av_create_and_unshift_one(aTHX_ &PL_preambleav,
                                                 Perl_newSVpvf(aTHX_
-        "BEGIN { do {local $!; -f q%c%"SVf"/buildcustomize.pl%c} and do q%c%"SVf"/buildcustomize.pl%c || die $@ }",
+                               "BEGIN { do {local $!; -f q%c./%"SVf
+                               "/buildcustomize.pl%c} and do q%c./%"SVf
+                               "/buildcustomize.pl%c || die $@ }",
                                                               0, SVfARG(*inc0), 0,
                                                               0, SVfARG(*inc0), 0));
        }
                                                               0, SVfARG(*inc0), 0,
                                                               0, SVfARG(*inc0), 0));
        }