summaryrefslogtreecommitdiff
path: root/ext/DynaLoader
diff options
context:
space:
mode:
authorCraig A. Berry <craigberry@mac.com>2016-02-13 16:29:14 -0600
committerCraig A. Berry <craigberry@mac.com>2016-02-13 18:35:07 -0600
commit907196b2ca1c36611c32cb89c75e791391979005 (patch)
treea3a7d218c6e08398d1444d91d65d45cb2834cba9 /ext/DynaLoader
parent7d2d29f684a62da1d3ce84a1267842d35219a6d8 (diff)
downloadperl-907196b2ca1c36611c32cb89c75e791391979005.tar.gz
DynaLoader shouldn't use mod2fname when finding .bs files.
Some platforms (probably only VMS and Android at the moment) take special steps via the function DynaLoader::mod2fname to construct a dynamic library name that will be unique and (if too long) truncated. Then DynaLoader looks for a bootstrap file with the exact same name as the dynamic library except with a .bs file extension. However, ExtUtils::MakeMaker has never produced bootstrap files that have been run through mod2fname, so while a Foo:Bar extension would produce a loadable library named PL__Foo_Bar.exe, the bootstrap would be called Bar.bs. That shouldn't be a problem since the bootstrap file is just Perl code read by Perl, but DynaLoader has (apparently forever) been looking for PL__Foo_Bar.bs and not finding it. So let's look for it by the name under which it actually exists. There are no core extensions that produce non-empty bootstrap files and no existing test coverage, but as-yet-unintegrated versions of MakeMaker do have such tests. See, for example, https://github.com/Perl-Toolchain-Gang/ExtUtils-MakeMaker/commit/7f5e9a35addeea7ebfcded28277c85f723e1a5de
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r--ext/DynaLoader/DynaLoader_pm.PL10
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/DynaLoader/DynaLoader_pm.PL b/ext/DynaLoader/DynaLoader_pm.PL
index c2e860bd4b..e828f35757 100644
--- a/ext/DynaLoader/DynaLoader_pm.PL
+++ b/ext/DynaLoader/DynaLoader_pm.PL
@@ -85,7 +85,7 @@ package DynaLoader;
# Tim.Bunce@ig.co.uk, August 1994
BEGIN {
- $VERSION = '1.37';
+ $VERSION = '1.38';
}
EOT
@@ -319,6 +319,7 @@ sub bootstrap {
<</$^O-eq-os2>>
my @modparts = split(/::/,$module);
my $modfname = $modparts[-1];
+ my $modfname_orig = $modfname; # For .bs file search
# Some systems have restrictions on files names for DLL's etc.
# mod2fname returns appropriate file base name (typically truncated)
@@ -338,9 +339,10 @@ sub bootstrap {
"(auto/$modpname/$modfname.$dl_dlext)\n"
if $dl_debug;
+ my $dir;
foreach (@INC) {
<<$^O-eq-VMS>>chop($_ = VMS::Filespec::unixpath($_));<</$^O-eq-VMS>>
- my $dir = "$_/auto/$modpname";
+ $dir = "$_/auto/$modpname";
next unless -d $dir; # skip over uninteresting directories
@@ -365,7 +367,9 @@ sub bootstrap {
# Execute optional '.bootstrap' perl script for this module.
# The .bs file can be used to configure @dl_resolve_using etc to
# match the needs of the individual module on this architecture.
- my $bs = $file;
+ # N.B. The .bs file does not following the naming convention used
+ # by mod2fname.
+ my $bs = "$dir/$modfname_orig";
$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;