Subject: | Makefile.PL fails due to unescaped paths interpolated in regex pattern |
Date: | Wed, 29 Mar 2017 22:57:15 -0400 |
To: | bug-List-MoreUtils [...] rt.cpan.org |
From: | "A. Sinan Unur" <sinan [...] unur.com> |
I get:
$ perl Makefile.PL
***
This version of List::MoreUtils conflicts with
the version of List::MoreUtils (0.416) you have installed.
It's strongly recommended that you carefully read
the Changes file and test your application with
this version before finally upgrading.
See local::lib how to do it easily.
***
Missing braces on \o{} in regex; marked by <-- HERE in m/^c:\o <--
HERE pt\perl\site\5.24.1\lib/ at Makefile.PL line 163.
The reason for that is simple. On my install (Windows, perl built with
Visual Studio '13 tools), I have:
$ perl -MConfig -E "say $Config{installsitearch}"
c:\opt\perl\site\5.24.1\lib
When this string is interpolated in regex pattern, \o is taken to
signify start of an octal escape sequence.
The fix is to *always* apply quotemeta to file paths used in regex
patterns. This frequently shows up when using Windows paths, but it is
a bigger and more important issue on *nixy systems as well since a
file path can contain almost any character on such systems.
So, for example, on line 163, use
m,^\Q$Config{installsitearch},
and ditto for other places where file paths are used in regex patterns.
HTH,
-- Sinan