Skip to content

Commit 51f49c0

Browse files
committed
Config release 6.27
DynaLoader.pm broken on 5.8 was probably fixed by P5P in commit 816b255b3713d16e7c9ee4c3736d7096b851b609 "Wrap the $VERSION initialization of DynaLoader in a BEGIN block" Perl #40651, which is between 5.9.4 and 5.9.5, also the bug is not reproducable on Windows 5.8.9 since DynaLoader.o used to be hackishly compiled by win32/Makefile or win32/makefile.mk directly, rather than from an EUMM makefile, and -DXS_VERSION macro was never passed to the CC when compiling DynaLoader.o on Windows, so there was no version check in boot_DynaLoader() C func on Win32 back then. Nowadays DynaLoader on Win32 is compiled with a standard EUMM makefile and -DXS_VERSION is passed on cmd line to the CC.
1 parent ac14fe8 commit 51f49c0

10 files changed

+67
-4
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ before_install:
5151
- eval $(curl https://travis-perl.github.io/init) --auto
5252

5353
install:
54+
- cpan-install --deps
5455
- export COVERAGE=0 AUTOMATED_TESTING=1
5556

5657
script: "perl Makefile.PL && make && make test"

Changes

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
Revision history for XSConfig
2+
6.27 Wed, Jul 11, 2018 4:17:07 PM
3+
-Fixed CPAN RT#125756, DynaLoader.pm broken on 5.8 with XSConfig
4+
25
6.26 Sun, Jul 01, 2018 4:01:17 PM
36
-version bump because most CPAN Testers builders dont test alpha
47
versions

Config.pm

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use strict;
1010
use warnings;
1111
our (%Config, $VERSION);
1212

13-
$VERSION = '6.26';
13+
$VERSION = '6.27';
1414

1515
# Skip @Config::EXPORT because it only contains %Config, which we special
1616
# case below as it's not a function. @Config::EXPORT won't change in the
@@ -59,6 +59,9 @@ sub import {
5959
sub DESTROY { }
6060

6161
if (defined &DynaLoader::boot_DynaLoader) {
62+
#next 2 lines are special matched in Makefile.PL, update that if changed
63+
delete local $DynaLoader::{'VERSION'} if $] lt '5.009005';
64+
delete local $DynaLoader::{'XS_VERSION'} if $] lt '5.009005';
6265
require XSLoader;
6366
XSLoader::load(__PACKAGE__, $VERSION);
6467
tie %Config, 'Config';

Config_mini.pl.PL

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#usage: perl Config_mini.pl.PL [ignored]
44

55
use strict ;
6-
my $VERSION = '6.26';
6+
my $VERSION = '6.27';
77
use ExtUtils::Command;
88

99
my $mini = searchdirs('Config_mini.pl', \@INC);

Config_pm.PL

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/perl -*- coding: no-conversion -*-
2+
3+
my $path = $ARGV[0];
4+
die "arg 1 is empty" unless $path;
5+
if($] ge '5.009005') {
6+
open my $fh, '<', $path or die "Can't open $path: $!";
7+
my $data;
8+
{
9+
binmode($fh);
10+
local $/ = undef;
11+
$data = <$fh>;
12+
}
13+
close $fh or "Can't close $path: $!";
14+
my $match = q| #next 2 lines are special matched in Makefile.PL, update that if changed
15+
delete local $DynaLoader::{'VERSION'} if $] lt '5.009005';
16+
delete local $DynaLoader::{'XS_VERSION'} if $] lt '5.009005';
17+
|;
18+
my $pos = index($data, $match);
19+
die 'can\'t match in Config_pm.PL' if $pos == -1;
20+
substr($data, $pos,length($match),'');
21+
open $fh, '>', $path or die "Can't open $path: $!";
22+
syswrite($fh, $data) or die "Can't write $path: $!";
23+
print "patched $path\n";
24+
} else {
25+
print "did not patch $path\n";
26+
}

Config_xs.PL

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# lib/Config_git.pl
2020
#
2121

22-
$VERSION = '6.26';
22+
$VERSION = '6.27';
2323
my $in_core;
2424

2525
BEGIN {

MANIFEST

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Changes
22
Config.pm
33
Config_mini.pl.PL
4+
Config_pm.PL
45
Config_xs.in
56
Config_xs.out
67
Config_xs.PL
@@ -13,6 +14,7 @@ MANIFEST This list of files
1314
README
1415
regen/regen_lib.pl
1516
t/Config.t
17+
t/DynaLoader.t
1618
t/XSConfig.t
1719
typemap
1820
xsc_test.pl

Makefile.PL

+4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ push(@ExtUtils::MakeMaker::Overridable, qw(pm_to_blib));
66
my $in_core = ! -d "regen";
77
our $uninst;
88
my $version = MM->parse_version('Config.pm');
9+
my $pre_6_5503 = eval($ExtUtils::MakeMaker::VERSION) < 6.5503;
910

1011
WriteMakefile(
1112
'ABSTRACT' => 'Fast XS drop-in replacement for Config.pm with perfect hashing',
1213
'AUTHOR' => ($ExtUtils::MakeMaker::VERSION >= '6.58'
1314
? ['Daniel Dragan <[email protected]>', 'Reini Urban <[email protected]>']
1415
: 'Daniel Dragan <[email protected]>, Reini Urban <[email protected]>'),
16+
($pre_6_5503 ? 'PREREQ_PM' : 'BUILD_REQUIRES')
17+
=> {'MIME::Base64' => 0, 'IO::Compress::Bzip2' => 0},
1518
'DISTNAME' => 'XSConfig',
1619
'LICENSE' => 'perl',
1720
'NAME' => 'Config',
@@ -159,6 +162,7 @@ sub pm_to_blib {
159162
chomp($blib); #old EUMMs dont have a newline at the end, new ones do
160163
return $blib.'
161164
$(NOECHO) $(CHMOD) $(PERM_RW) $(INST_ARCHLIBDIR)/Config.pm
165+
$(NOECHO) $(PERLRUN) Config_pm.PL $(INST_ARCHLIBDIR)/Config.pm
162166
$(NOECHO) $(EQUALIZE_TIMESTAMP) Config_pm_mtime $(INST_ARCHLIBDIR)/Config.pm';
163167
}
164168

XSConfig.pod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ XSConfig - Fast XS drop-in replacement for Config.pm with perfect hashing.
44

55
=head1 VERSION
66

7-
Version 6.26
7+
Version 6.27
88

99
=head1 SYNOPSIS
1010

t/DynaLoader.t

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/perl
2+
eval "use DynaLoader;";
3+
if($@) {
4+
warn $@;
5+
print <<'END';
6+
1..1
7+
not ok 1 - RT #125756 Old DynaLoader works
8+
END
9+
} else {
10+
print <<'END';
11+
1..1
12+
ok 1 - RT #125756 Old DynaLoader works
13+
END
14+
}
15+
16+
#C:\perl587\srcnew>perl -MDynaLoader -e"exit 0"
17+
#DynaLoader object version 1.05 does not match $DynaLoader::VERSION at C:/perl58
18+
#7/srcnew/lib/XSLoader.pm line 16.
19+
#Compilation failed in require at C:/perl587/srcnew/lib/Config.pm line 62.
20+
#Compilation failed in require at C:/perl587/srcnew/lib/DynaLoader.pm line 25.
21+
#BEGIN failed--compilation aborted at C:/perl587/srcnew/lib/DynaLoader.pm line 25
22+
#.
23+
#Compilation failed in require.
24+
#BEGIN failed--compilation aborted.

0 commit comments

Comments
 (0)