Skip Menu |
 

This queue is for tickets about the Devel-CheckLib CPAN distribution.

Report information
The Basics
Id: 63742
Status: resolved
Priority: 0/
Queue: Devel-CheckLib

People
Owner: Nobody in particular
Requestors: sisyphus [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.91
Fixed in: (no value)



Subject: 61454 breaks Devel::CheckLib on ActivePerl
Download (untitled) / with headers
text/plain 1.6k
Hi, The patch at https://rt.cpan.org/Ticket/Display.html?id=61454 (which has been incorporated into Devel-CheckLib-0.91) renders that module unloadable on ActivePerl when using the MinGW compiler. As a demo, this script, when run on ActivePerl 5.10: ============================== use warnings; use strict; use Config qw(%Config); use Text::ParseWords 'quotewords'; my @flags = grep { length } map { quotewords('\s+', 0, $_ || ()) } @Config{qw(ccflags ldflags)}; print "@flags\n"; ============================== produces this output (and similar for ActivePerl 5.12): ============================== %Config::Config is read-only BEGIN failed--compilation aborted at C:/_32/ap1005/lib/ActiveState/Path.pm line 12. Compilation failed in require at C:/_32/ap1005/lib/ActivePerl/Config.pm line 46. ============================== Also, even on my own MinGW-built perls (where Devel-CheckLib-0.91 builds and passes all tests) @flags contains: ============================== -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT - DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields - DPERL_MSVCRT_READFIX -s -Lc:perl512_MlibCORE - LC:homerobmingw_vistai686-pc-mingw32lib ============================== (Note that the path separators are missing.) I haven't gone digging to see what's really needed here - on the surface, it looks as though we could just do: @flags = ($Config{ccflags}, $Config{ldflags}); I tried that out and it seemed to work ok (in so far as it didn't cause any tests to fail). However, I then noticed that t/multi-word-compiler.t also violates the "%Config::Config is read-only" condition on ActivePerl. In that file the violation is caused by: $Config{cc} = "$^X $Config{cc}"; Cheers, Rob
Download (untitled) / with headers
text/plain 2.7k
On Wed Dec 08 10:20:50 2010, SISYPHUS wrote: Show quoted text
> Hi, > The patch at https://rt.cpan.org/Ticket/Display.html?id=61454 (which > has been incorporated into Devel-CheckLib-0.91) renders that module > unloadable on ActivePerl when using the MinGW compiler. > > As a demo, this script, when run on ActivePerl 5.10: > > ============================== > use warnings; > use strict; > use Config qw(%Config); > use Text::ParseWords 'quotewords'; > > my @flags = grep { length } map > { quotewords('\s+', 0, $_ || ()) } > @Config{qw(ccflags ldflags)}; > > print "@flags\n"; > ============================== > > produces this output (and similar for ActivePerl 5.12): > > ============================== > %Config::Config is read-only > BEGIN failed--compilation aborted at > C:/_32/ap1005/lib/ActiveState/Path.pm line > 12. > Compilation failed in require at C:/_32/ap1005/lib/ActivePerl/Config.pm > line 46. > ============================== > > Also, even on my own MinGW-built perls (where Devel-CheckLib-0.91 > builds and passes all tests) @flags contains: > > ============================== > -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DPERL_IMPLICIT_CONTEXT - > DPERL_IMPLICIT_SYS -fno-strict-aliasing -mms-bitfields - > DPERL_MSVCRT_READFIX -s -Lc:perl512_MlibCORE - > LC:homerobmingw_vistai686-pc-mingw32lib > ============================== > > (Note that the path separators are missing.) > > I haven't gone digging to see what's really needed here - on the > surface, it looks as though we could just do: > > @flags = ($Config{ccflags}, $Config{ldflags}); > > I tried that out and it seemed to work ok (in so far as it didn't cause > any tests to fail). > > However, I then noticed that t/multi-word-compiler.t also violates the > "%Config::Config is read-only" condition on ActivePerl. > > In that file the violation is caused by: > > $Config{cc} = "$^X $Config{cc}"; > > Cheers, > Rob
I modified the quotewords() call in the 61454 ticket patch and that appears to fix the problem with the quotes and backslashes being stripped from the @flags, e.g.: (with keep=0) Show quoted text
pdl> p join "\n", ( @flags = grep { length } map { quotewords('\s+', 0,
$_) } @Config{qw(ccflags ldflags)} ); -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_READFIX -s -LC:Userschris.h.marshalllocalstrawberryperllibCORE -LC:Userschris.h.marshalllocalstrawberryclib (with keep=1) Show quoted text
pdl> p join "\n", ( @flags = grep { length } map { quotewords('\s+', 1,
$_) } @Config{qw(ccflags ldflags)} ); -s -O2 -DWIN32 -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -fno-strict-aliasing -DPERL_MSVCRT_READFIX -s -L"C:\Users\chris.h.marshall\local\strawberry\perl\lib\CORE" -L"C:\Users\chris.h.marshall\local\strawberry\c\lib"
Download (untitled) / with headers
text/plain 1.1k
I think this first problem could be fixed by using an explicit copy of the values needed from %Config and passing that to the map call. On Wed Dec 08 10:20:50 2010, SISYPHUS wrote: Show quoted text
> > my @flags = grep { length } map > { quotewords('\s+', 0, $_ || ()) } > @Config{qw(ccflags ldflags)}; > > print "@flags\n"; > ============================== > > produces this output (and similar for ActivePerl 5.12): > > ============================== > %Config::Config is read-only > BEGIN failed--compilation aborted at > C:/_32/ap1005/lib/ActiveState/Path.pm line > 12. > Compilation failed in require at C:/_32/ap1005/lib/ActivePerl/Config.pm > line 46. > ==============================
I'm not sure why a module would *ever* change the value of a %Config setting at runtime and would expect this to use a copy too. If the module requires a "fixed" %Config then a refactoring to avoid such might be in order. Show quoted text
> However, I then noticed that t/multi-word-compiler.t also violates the > "%Config::Config is read-only" condition on ActivePerl. > > In that file the violation is caused by: > > $Config{cc} = "$^X $Config{cc}";
Download (untitled) / with headers
text/plain 234b
Attached is a patch against Devel::CheckLib v0.91 that appears to fix the problem issues in the CheckLib.pm file. This does not include the fix to t/multi-word-compiler.t. That might be fixed by making $Config{cc} local to the test.
Subject: asperl-fix-patch
Download asperl-fix-patch
application/octet-stream 706b

Message body not shown because it is not plain text.

RT-Send-CC: chm [...] cpan.org
Download (untitled) / with headers
text/plain 1.8k
On Thu Dec 09 14:09:58 2010, CHM wrote: Show quoted text
> Attached is a patch against Devel::CheckLib v0.91 > that appears to fix the problem issues in the > CheckLib.pm file. This does not include the fix > to t/multi-word-compiler.t. That might be fixed > by making $Config{cc} local to the test.
The patch is fine. Now we just need to fix the issue with t/multi-word- compiler.t - local()ising $Config{cc} didn't help. The test fails only when run under 'dmake test' (possibly, I guess, because STORE gets redefined back to something unsuitable): ================================= C:\_32\comp\Devel-CheckLib-0.91>dmake test [snip] t/multi-word-compiler.t ....... Subroutine STORE redefined at C:/_32/ap1202/lib/Config_heavy.pl line 1290. %Config::Config is read-only # Looks like your test exited with 2 before it could output anything. t/multi-word-compiler.t ....... Dubious, test returned 2 (wstat 512, 0x200) Failed 1/1 subtests t/not_found.t ................. ok [snip] ================================= If I run that test script as 'perl -Mblib t/multi-word-compiler.t', STORE does not get redefined, and the test passes: ================================= C:\_32\comp\Devel-CheckLib-0.91>perl -Mblib t/multi-word-compiler.t 1..1 Set up gcc environment - 3.4.5 (mingw special) ok 1 - Good multi-word compiler is OK ================================= Having installed this patched version of the module, the output of running 'perl t/multi-word-compiler.t' is different again. The test fails once more, but there's no mention of STORE being redefined: ================================= C:\_32\comp\Devel-CheckLib-0.91>perl t/multi-word-compiler.t 1..1 Set up gcc environment - 3.4.5 (mingw special) %Config::Config is read-only # Looks like your test exited with 2 before it could output anything. ================================= Cheers, Rob
Subject: Re: [rt.cpan.org #63742] 61454 breaks Devel::CheckLib on ActivePerl
Date: Thu, 09 Dec 2010 21:49:52 -0500
To: bug-Devel-CheckLib [...] rt.cpan.org
From: Chris Marshall <chm [...] alum.mit.edu>
I get the STORE redefined messages with cygwin but the tests pass. --Chris On 12/9/2010 8:32 PM, Sisyphus via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=63742> > > On Thu Dec 09 14:09:58 2010, CHM wrote:
>> Attached is a patch against Devel::CheckLib v0.91 >> that appears to fix the problem issues in the >> CheckLib.pm file. This does not include the fix >> to t/multi-word-compiler.t. That might be fixed >> by making $Config{cc} local to the test.
> > The patch is fine. Now we just need to fix the issue with t/multi-word- > compiler.t - local()ising $Config{cc} didn't help. > > The test fails only when run under 'dmake test' (possibly, I guess, > because STORE gets redefined back to something unsuitable): > > ================================= > C:\_32\comp\Devel-CheckLib-0.91>dmake test > [snip] > t/multi-word-compiler.t ....... Subroutine STORE redefined at > C:/_32/ap1202/lib/Config_heavy.pl line 1290. > %Config::Config is read-only > # Looks like your test exited with 2 before it could output anything. > t/multi-word-compiler.t ....... Dubious, test returned 2 (wstat 512, > 0x200) > Failed 1/1 subtests > t/not_found.t ................. ok > [snip] > ================================= > > If I run that test script as 'perl -Mblib t/multi-word-compiler.t', > STORE does not get redefined, and the test passes: > > ================================= > > C:\_32\comp\Devel-CheckLib-0.91>perl -Mblib t/multi-word-compiler.t > 1..1 > Set up gcc environment - 3.4.5 (mingw special) > ok 1 - Good multi-word compiler is OK > ================================= > > Having installed this patched version of the module, the output of > running 'perl t/multi-word-compiler.t' is different again. The test > fails once more, but there's no mention of STORE being redefined: > > ================================= > C:\_32\comp\Devel-CheckLib-0.91>perl t/multi-word-compiler.t > 1..1 > Set up gcc environment - 3.4.5 (mingw special) > %Config::Config is read-only > # Looks like your test exited with 2 before it could output anything. > ================================= > > Cheers, > Rob
Download (untitled) / with headers
text/plain 304b
I just realized that the STORE redefined messages must be related to the ActiveState Perl tie of %Config that you mentioned was how they support mingw compilation... On Thu Dec 09 21:49:58 2010, chm@alum.mit.edu wrote: Show quoted text
> I get the STORE redefined messages with cygwin > but the tests pass. > > --Chris
RT-Send-CC: chm [...] cpan.org
Download (untitled) / with headers
text/plain 1.8k
On Thu Dec 09 14:09:58 2010, CHM wrote: Show quoted text
> Attached is a patch against Devel::CheckLib v0.91 > that appears to fix the problem issues in the > CheckLib.pm file. This does not include the fix > to t/multi-word-compiler.t. That might be fixed > by making $Config{cc} local to the test.
Here (and also attached) is a patch to t/multi-word-compiler.t that, in conjunction with the CheckLib.pm patch, allows multi-word-compiler.t to pass its test using ActivePerl and the MinGW compiler: ================================ --- multi-word-compiler.t_orig Sat Dec 11 14:37:41 2010 +++ multi-word-compiler.t Sat Dec 11 14:34:49 2010 @@ -10,9 +10,18 @@ use Config; BEGIN { BEGIN { if (not $] < 5.006 ) { warnings->unimport('redefine') } } - *Config::STORE = sub { $_[0]->{$_[1]} = $_[2] } + unless(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) { + *Config::STORE = sub { $_[0]->{$_[1]} = $_[2] } + } +} + +if(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) { + my $obj = tied %Config::Config; + $obj->{cc} = "$^X $Config{cc}"; +} +else { + $Config{cc} = "$^X $Config{cc}"; } -$Config{cc} = "$^X $Config{cc}"; eval "use Devel::CheckLib"; ok(!$@, "Good multi-word compiler is OK"); ================================ Note that the removal of the assignment to *Config::STORE (in the BEGIN block) is not really necessary - it makes no difference whether that assignment is made (or not) when we're using ActivePerl and MinGW. Note also that I don't really understand what this test is trying to achieve. Faik, my changes may render this test pointless on ActivePerl/MinGW. I couldn't find a way of making %Config writable - the only way I could get $Config{cc} to report "$^X $Config{cc}" was to tie an object to % Config - which is what ActiveState do in the first place, in order to override the built-in %Config values with values that are suitable for MinGW. Cheers, Rob
Subject: multi-word-compiler.t.patch
--- multi-word-compiler.t_orig Sat Dec 11 14:37:41 2010 +++ multi-word-compiler.t Sat Dec 11 14:34:49 2010 @@ -10,9 +10,18 @@ use Config; BEGIN { BEGIN { if (not $] < 5.006 ) { warnings->unimport('redefine') } } - *Config::STORE = sub { $_[0]->{$_[1]} = $_[2] } + unless(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) { + *Config::STORE = sub { $_[0]->{$_[1]} = $_[2] } + } +} + +if(defined($ActivePerl::VERSION) && $Config{cc} =~ /\bgcc\b/) { + my $obj = tied %Config::Config; + $obj->{cc} = "$^X $Config{cc}"; +} +else { + $Config{cc} = "$^X $Config{cc}"; } -$Config{cc} = "$^X $Config{cc}"; eval "use Devel::CheckLib"; ok(!$@, "Good multi-word compiler is OK");


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.