Skip Menu |
 

This queue is for tickets about the Data-FormValidator CPAN distribution.

Maintainer(s)' notes

This is the bug queue for Data::FormValidator.

Report information
The Basics
Id: 120671
Status: new
Priority: 0/
Queue: Data-FormValidator

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
0001-Absolutize-filenames-during-construction.patch



Subject: Fails tests when no "." in @INC
On 5.25.10 with -Ddefault_inc_excludes_dot

 perl -Ilib t/00_base.t
1..5
ok 1 - use Data::FormValidator;
ok 2 - second argument must be a hash ref or die
ok 3 - bad profile file names should cause death
ok 4 - profile files should return a hash ref
Input profiles didn't return a hash ref:
Show quoted text
# Looks like your test exited with 2 just after 4.

PERL_USE_UNSAFE_INC=1 perl -Ilib t/00_base.t
1..5
ok 1 - use Data::FormValidator;
ok 2 - second argument must be a hash ref or die
ok 3 - bad profile file names should cause death
ok 4 - profile files should return a hash ref
ok 5 - loading a profile from a file works



-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
load_profiles does

    $self->{profiles} = do $file;

And "do file" implies "@INC" traversal.

This will need special treatment.

-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )

Possible fix submitted to https://github.com/dnmfarrell/Data-FormValidator/pull/6

 

Attached here for completeness

-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
 

Subject: 0001-Absolutize-filenames-during-construction.patch
From bfc088aa911062d987c830d5bb56aa4afd0d3735 Mon Sep 17 00:00:00 2001 From: Kent Fredric <kentfredric@gmail.com> Date: Sun, 4 Jun 2017 00:40:04 +1200 Subject: [PATCH] Absolutize filenames during construction This way, any relative paths become absolute as soon as possible, so that if chdir happens between "new" and "load_profiles", the loaded file won't magically change. This also aims to turn the <do "file.pm"> into a <do "/path/to/File.pm"> as the former no longer reads from "." since Perl 5.25.11, as paths with neither leading "./" or leading "/" imply @INC traversal. This aims to resolve RT#120671 https://rt.cpan.org/Ticket/Display.html?id=120671 --- Makefile.PL | 1 + lib/Data/FormValidator.pm | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.PL b/Makefile.PL index a9839a6..cef175a 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -19,6 +19,7 @@ WriteMakefile( 'Regexp::Common' => 0.03, # when ::whitespace was added 'Scalar::Util' => 0, 'Email::Valid' => 0, + 'File::Spec' => 0, }, (eval { ExtUtils::MakeMaker->VERSION(6.46) } ? (META_MERGE => { 'meta-spec' => { version => 2 }, diff --git a/lib/Data/FormValidator.pm b/lib/Data/FormValidator.pm index 7075dc4..bc0709e 100644 --- a/lib/Data/FormValidator.pm +++ b/lib/Data/FormValidator.pm @@ -24,6 +24,7 @@ package Data::FormValidator; use Exporter 'import'; +use File::Spec qw(); use 5.008; use Data::FormValidator::Results; @@ -147,7 +148,7 @@ sub new { $profiles = $profiles_or_file; } else { - $file = $profiles_or_file; + $file = File::Spec->rel2abs( $profiles_or_file ); } -- 2.12.2


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.