On Sat, Feb 25, 2012 at 10:06:29PM +0200, Niko Tyni wrote:
> On Sat, Feb 25, 2012 at 03:39:43PM +0200, Niko Tyni wrote:
> > 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.

I should have looked at this a bit more in the first place. OPTIMIZE
actually does get passed through, albeit in a somewhat different way:
the top level Makefile uses the sub-Makefiles with something like
 $(MAKE) OPTIMIZE=$(OPTIMIZE)
which overrides the settings inside the sub-Makefiles themselves.

LD isn't passed through, though.

> The attached patch whitelists LD and OPTIMIZE.

Turns out that there's another whitelist that implements the above,
and as noted it already includes OPTIMIZE. So just adding LD to
that seems cleaner. Revised patch attached.

> The next step could be finding out which XS module packages have
> more than one Makefile.PL inside and testing those.

This still applies.
-- 
Niko Tyni   [email protected]
>From 6005828c22681ca0a23db2383692a5826c09cfbc Mon Sep 17 00:00:00 2001
From: Niko Tyni <[email protected]>
Date: Sat, 25 Feb 2012 19:41:27 +0200
Subject: [PATCH] Make EU::MM pass LD through to recursive Makefile.PL
 invocations

In a directory hierarchy with Makefile.PL files in subdirectories,
command line arguments like
 perl Makefile.PL LD="ld -Wl,-z relro"
are not used when descending into the subdirectories.

This seems to be by design: there's a short list of variables
that are passed through when invoking 'make' in the subdirectories,
but the rest just use their default values.

Debian needs to pass LD through for sane handling of security related
build flags, so add that to the whitelist.

Bug: http://rt.cpan.org/Public/Bug/Display.html?id=28632
Bug-Debian: http://bugs.debian.org/660195
Patch-Name: debian/makemaker-pasthru.diff
---
 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
index c308c49..d1ce7b7 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Unix.pm
@@ -2674,7 +2674,7 @@ sub pasthru {
     my($sep) = $Is{VMS} ? ',' : '';
     $sep .= "\\\n\t";
 
-    foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE
+    foreach my $key (qw(LIB LIBPERL_A LINKTYPE OPTIMIZE LD
                      PREFIX INSTALL_BASE)
                  ) 
     {

Reply via email to