Change 34424 by [EMAIL PROTECTED] on 2008/09/26 10:30:37
Integrate:
[ 34388]
Subject: Fwd: CPAN Upload: S/SA/SAPER/XSLoader-0.09.tar.gz
From: Sébastien Aperghis-Tramoni <[EMAIL PROTECTED]>
Date: Sun, 21 Sep 2008 18:31:48 +0200
Message-Id: <[EMAIL PROTECTED]>
[ 34392]
Avoid uninitialized warnings from XSLoader
[ 34402]
Subject: [perl #59208][PATCH 5.8.x] ext/DynaLoader/t/XSLoader.t
assumes dynamic loading
From: Andy Dougherty <[EMAIL PROTECTED]>
Date: Mon, 22 Sep 2008 13:36:57 -0400 (EDT)
Message-ID: <[EMAIL PROTECTED]>
[ 34404]
Fix tests for the case of -Du_usedl
[ 34422]
Upgrade to XSLoader 0.10.
Affected files ...
... //depot/maint-5.10/perl/ext/DynaLoader/XSLoader_pm.PL#2 integrate
... //depot/maint-5.10/perl/ext/DynaLoader/t/DynaLoader.t#2 integrate
... //depot/maint-5.10/perl/ext/DynaLoader/t/XSLoader.t#2 integrate
Differences ...
==== //depot/maint-5.10/perl/ext/DynaLoader/XSLoader_pm.PL#2 (text) ====
Index: perl/ext/DynaLoader/XSLoader_pm.PL
--- perl/ext/DynaLoader/XSLoader_pm.PL#1~32694~ 2007-12-22 01:23:09.000000000
-0800
+++ perl/ext/DynaLoader/XSLoader_pm.PL 2008-09-26 03:30:37.000000000 -0700
@@ -15,7 +15,7 @@
package XSLoader;
-$VERSION = "0.08";
+$VERSION = "0.10";
#use strict;
@@ -44,8 +44,8 @@
my($module) = $_[0];
# work with static linking too
- my $b = "$module\::bootstrap";
- goto &$b if defined &$b;
+ my $boots = "$module\::bootstrap";
+ goto &$boots if defined &$boots;
goto retry unless $module and defined &dl_load_file;
@@ -81,6 +81,12 @@
my $bs = $file;
$bs =~ s/(\.\w+)?(;\d*)?$/\.bs/; # look for .bs 'beside' the library
+ if (-s $bs) { # only read file if it's not empty
+# print STDERR "BS: $bs ($^O, $dlsrc)\n" if $dl_debug;
+ eval { do $bs; };
+ warn "$bs: [EMAIL PROTECTED]" if $@;
+ }
+
goto retry if not -f $file or -s $bs;
my $bootname = "boot_$module";
@@ -127,7 +133,7 @@
push(@DynaLoader::dl_modules, $module); # record loaded module
boot:
- my $xs = dl_install_xsub("${module}::bootstrap", $boot_symbol_ref, $file);
+ my $xs = dl_install_xsub($boots, $boot_symbol_ref, $file);
# See comment block above
push(@DynaLoader::dl_shared_objects, $file); # record files loaded
@@ -162,7 +168,7 @@
=head1 VERSION
-Version 0.08
+Version 0.10
=head1 SYNOPSIS
@@ -388,7 +394,9 @@
Previous maintainer was Michael G Schwern <[EMAIL PROTECTED]>.
-=head1 COPYRIGHT
+=head1 COPYRIGHT & LICENSE
+
+Copyright (C) 1990-2007 by Larry Wall and others.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
==== //depot/maint-5.10/perl/ext/DynaLoader/t/DynaLoader.t#2 (text) ====
Index: perl/ext/DynaLoader/t/DynaLoader.t
--- perl/ext/DynaLoader/t/DynaLoader.t#1~32694~ 2007-12-22 01:23:09.000000000
-0800
+++ perl/ext/DynaLoader/t/DynaLoader.t 2008-09-26 03:30:37.000000000 -0700
@@ -42,15 +42,23 @@
# Check functions
can_ok( 'DynaLoader' => 'bootstrap' ); # defined in Perl section
-can_ok( 'DynaLoader' => 'dl_error' ); # defined in XS section
-can_ok( 'DynaLoader' => 'dl_find_symbol' ); # defined in XS section
-can_ok( 'DynaLoader' => 'dl_install_xsub' ); # defined in XS section
-can_ok( 'DynaLoader' => 'dl_load_file' ); # defined in XS section
can_ok( 'DynaLoader' => 'dl_load_flags' ); # defined in Perl section
-can_ok( 'DynaLoader' => 'dl_undef_symbols' ); # defined in XS section
-SKIP: {
- skip "unloading unsupported on $^O", 1 if ($^O eq 'VMS' || $^O eq
'darwin');
- can_ok( 'DynaLoader' => 'dl_unload_file' ); # defined in XS
section
+can_ok( 'DynaLoader' => 'dl_error' ); # defined in XS section
+if ($Config{usedl}) {
+ can_ok( 'DynaLoader' => 'dl_find_symbol' ); # defined in XS section
+ can_ok( 'DynaLoader' => 'dl_install_xsub' ); # defined in XS section
+ can_ok( 'DynaLoader' => 'dl_load_file' ); # defined in XS section
+ can_ok( 'DynaLoader' => 'dl_undef_symbols' ); # defined in XS section
+ SKIP: {
+ skip "unloading unsupported on $^O", 1 if ($^O eq 'VMS' || $^O eq
'darwin');
+ can_ok( 'DynaLoader' => 'dl_unload_file' ); # defined in XS section
+ }
+} else {
+ foreach my $symbol (qw(dl_find_symbol dl_install_sub dl_load_file
+ dl_undef_symbols dl_unload_file)) {
+ is(DynaLoader->can($symbol), undef,
+ "Without dynamic loading, DynaLoader should not have $symbol");
+ }
}
TODO: {
@@ -68,16 +76,24 @@
"calling DynaLoader::bootstrap() with no argument" );
eval { package egg_bacon_sausage_and_spam;
DynaLoader::bootstrap("egg_bacon_sausage_and_spam") };
-like( $@, q{/^Can't locate loadable object for module
egg_bacon_sausage_and_spam/},
+if ($Config{usedl}) {
+ like( $@, q{/^Can't locate loadable object for module
egg_bacon_sausage_and_spam/},
+ "calling DynaLoader::bootstrap() with a package without binary object"
);
+} else {
+ like( $@, q{/^Can't load module egg_bacon_sausage_and_spam/},
"calling DynaLoader::bootstrap() with a package without binary object"
);
+}
# .. for dl_load_file()
-eval { DynaLoader::dl_load_file() };
-like( $@, q{/^Usage: DynaLoader::dl_load_file\(filename, flags=0\)/},
- "calling DynaLoader::dl_load_file() with no argument" );
+SKIP: {
+ skip "no dl_load_file with dl_none.xs", 2 unless $Config{usedl};
+ eval { DynaLoader::dl_load_file() };
+ like( $@, q{/^Usage: DynaLoader::dl_load_file\(filename, flags=0\)/},
+ "calling DynaLoader::dl_load_file() with no argument" );
-eval { no warnings 'uninitialized'; DynaLoader::dl_load_file(undef) };
-is( $@, '', "calling DynaLoader::dl_load_file() with undefined argument" );
# is this expected ?
+ eval { no warnings 'uninitialized'; DynaLoader::dl_load_file(undef) };
+ is( $@, '', "calling DynaLoader::dl_load_file() with undefined argument"
); # is this expected ?
+}
my ($dlhandle, $dlerr);
eval { $dlhandle = DynaLoader::dl_load_file("egg_bacon_sausage_and_spam") };
==== //depot/maint-5.10/perl/ext/DynaLoader/t/XSLoader.t#2 (text) ====
Index: perl/ext/DynaLoader/t/XSLoader.t
--- perl/ext/DynaLoader/t/XSLoader.t#1~32694~ 2007-12-22 01:23:09.000000000
-0800
+++ perl/ext/DynaLoader/t/XSLoader.t 2008-09-26 03:30:37.000000000 -0700
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -T
+#!perl -T
BEGIN {
if( $ENV{PERL_CORE} ) {
@@ -37,7 +37,7 @@
'Time::HiRes'=> q| ::can_ok( 'Time::HiRes' => 'usleep' ) |, # 5.7.3
);
-plan tests => keys(%modules) * 3 + 5;
+plan tests => keys(%modules) * 4 + 5;
# Try to load the module
use_ok( 'XSLoader' );
@@ -52,20 +52,31 @@
"calling XSLoader::load() with no argument" );
eval q{ package Thwack; XSLoader::load('Thwack'); };
-like( $@, q{/^Can't locate loadable object for module Thwack in @INC/},
+if ($Config{usedl}) {
+ like( $@, q{/^Can't locate loadable object for module Thwack in @INC/},
"calling XSLoader::load() under a package with no XS part" );
+}
+else {
+ like( $@, q{/^Can't load module Thwack, dynamic loading not available in
this perl./},
+ "calling XSLoader::load() under a package with no XS part" );
+}
# Now try to load well known XS modules
my $extensions = $Config{'extensions'};
$extensions =~ s|/|::|g;
for my $module (sort keys %modules) {
+ my $warnings = "";
+ local $SIG{__WARN__} = sub { $warnings = $_[0] };
+
SKIP: {
- skip "$module not available", 3 if $extensions !~ /\b$module\b/;
+ skip "$module not available", 4 if $extensions !~ /\b$module\b/;
eval qq{ package $module; XSLoader::load('$module', "qunckkk"); };
like( $@, "/^$module object version \\S+ does not match bootstrap
parameter (?:qunckkk|0)/",
"calling XSLoader::load() with a XS module and an incorrect
version" );
+ like( $warnings, "/^\$|^Version string 'qunckkk' contains invalid
data; ignoring: 'qunckkk'/",
+ "in Perl 5.10, DynaLoader warns about the incorrect version
string" );
eval qq{ package $module; XSLoader::load('$module'); };
is( $@, '', "XSLoader::load($module)");
End of Patch.