Bug#660195: perl: Makefile.PL arguments not passed to recursive invocations

Niko Tyni ntyni at debian.org
Sat Feb 25 13:39:43 UTC 2012


On Fri, Feb 17, 2012 at 12:19:28PM +0200, Niko Tyni wrote:
> Package: perl
> Version: 5.14.2-7
> Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=28632
> 
> As noted in #657853, Makefile.PL command line arguments like OPTIMIZE and
> LD aren't passed down to recursive invocations when there are Makefile.PL
> files in subdirectories. This is hindering the adoption of hardening
> build flags.
> 
> The libimager-perl package is an example.
> 
> The bug is probably somewhere around eval_in_x(), which has
>     {
>         package main;
>         do './Makefile.PL';
>     };

Nope, that's not it. @ARGV is a global and is defined in the second
invocation too.

The behaviour seems to be intended: the logic is in the 
 if (defined $Parent[-2])
block in ExtUtils::MakeMaker::new(), around MakeMaker.pm:540-580.
Quoting:

            foreach my $opt (qw(POLLUTE PERL_CORE LINKTYPE)) {
                if (exists $self->{PARENT}->{$opt}
                    and not exists $self->{$opt})
                    {
                        # inherit, but only if already unspecified
                        $self->{$opt} = $self->{PARENT}->{$opt};
                    }
            }

Adding LD to the option list makes it go through to the sub-Makefiles.

Patching the code so that all the command line arguments go through
seems rather invasive IMO, at least without a better understanding
of the issue. Just adding LD and OPTIMIZE would cover our use case.
Perhaps we should try that and run a test rebuild of affected packages.

Also, makemaker at perl.org would presumably know best so they should
probably be involved.
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list