summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZefram <zefram@fysh.org>2017-07-20 07:20:52 +0100
committerZefram <zefram@fysh.org>2017-07-20 07:20:52 +0100
commit8316a7e5fe811053d160adb18b0f473d2f070a43 (patch)
tree358ac7eeeef5a9bcb1781e8b17a75cae44c37ea4
parent2ba334c7bf8365ab5c22306f4ef14f6d16569157 (diff)
downloadperl-8316a7e5fe811053d160adb18b0f473d2f070a43.tar.gz
fix PathTools dynamic linking for Perl 5.6
On Perl 5.6, PathTools's use of SvPV_nomg() is satisfied by a definition in ppport.h. That definition calls out to the function sv_2pv_flags(), which is also not defined by the 5.6. ppport.h can define the function, but doesn't unless requested to. Cwd.xs wasn't requesting it, resulting in Cwd.so having a reference to a non-existent function of a decorated version of that name. Fix this by making Cwd.xs request that function. Some of the existing test cases already exercise the call out to sv_2pv_flags(), but in non-obvious ways. Add a more direct test, requesting canonisation of a number. However, the use of PERL_DL_NONLAZY for running the test suite hides the problem. The XS loading for PathTools is optional, so with PERL_DL_NONLAZY making the loading fail due to the unresolvable symbol, PathTools just falls back to its pure Perl backup implementation, and passes all the tests. The problem only really manifests when PERL_DL_NONLAZY is unset, i.e., in real use: the XS loading succeeds, so PathTools will rely on the XS, but then the code fails when called. This issue remains, lurking to bite if PathTools develops another dynamic linking problem in the future.
-rw-r--r--dist/PathTools/Changes1
-rw-r--r--dist/PathTools/Cwd.xs1
-rw-r--r--dist/PathTools/t/Spec.t1
3 files changed, 3 insertions, 0 deletions
diff --git a/dist/PathTools/Changes b/dist/PathTools/Changes
index c3c53ed0fc..b145794357 100644
--- a/dist/PathTools/Changes
+++ b/dist/PathTools/Changes
@@ -3,6 +3,7 @@ Revision history for Perl distribution PathTools.
3.68
- avoid warning from pre-5.8 code for detecting tainted values
- make taint.t detect that a pre-5.8 Perl supports tainting
+- avoid a dynamic linking problem on Perl 5.6
3.67 - Mon Feb 27 09:33:04 EST 2017
- Add security usage note to File::Spec::no_upwards
diff --git a/dist/PathTools/Cwd.xs b/dist/PathTools/Cwd.xs
index c6c600b6ae..9f5f7ba6c4 100644
--- a/dist/PathTools/Cwd.xs
+++ b/dist/PathTools/Cwd.xs
@@ -7,6 +7,7 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
+#define NEED_sv_2pv_flags
#define NEED_my_strlcpy
#define NEED_my_strlcat
#include "ppport.h"
diff --git a/dist/PathTools/t/Spec.t b/dist/PathTools/t/Spec.t
index 0255bdb1bf..d4fb69a2f1 100644
--- a/dist/PathTools/t/Spec.t
+++ b/dist/PathTools/t/Spec.t
@@ -139,6 +139,7 @@ my @tests = (
($] >= 5.008 ? (
[ "Unix->canonpath(do { my \$x = '///a'.chr(0xaf); use utf8 (); utf8::upgrade(\$x); \$x })", '/a'.chr(0xaf) ],
) : ()),
+[ "Unix->canonpath(1)", '1' ],
[ "Unix->abs2rel('/t1/t2/t3','/t1/t2/t3')", '.' ],
[ "Unix->abs2rel('/t1/t2/t4','/t1/t2/t3')", '../t4' ],