Skip Menu |

This queue is for tickets about the lib-restrict CPAN distribution.

Report information
The Basics
Id: 97973
Status: open
Priority: 0/
Queue: lib-restrict

People
Owner: dmuey [...] cpan.org
Requestors: me [...] eboxr.com
Cc:
AdminCc:

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



Subject: test failure with perl 5.20.0
I suspect that the problem comes from the fact that during the unit test we use an array ref for $ENV{'lib::restrict-!-d_ok_in'} which looks to not work with perl 520.0 Show quoted text
> perl514 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref $ENV{"foo"}'
ARRAY Show quoted text
> perl520 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref $ENV{"foo"}'
# no return note that we have an array in %ENV, looks like to be unblessed ? Show quoted text
> perl -E '$ENV{"foo"} = [ 1..3 ]; say $ENV{"foo"}; say ref $ENV{"foo"}'
ARRAY(0xb31148) * Error while running the unit test: + /usr/bin/make test PERL_DL_NONLAZY=1 /usr/local/cpanel/3rdparty/perl/520/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t # Failed test '!-d parent exists uid' # at t/lib-restrict.t line 59. # Failed test '!-d parent exists code ref false' # at t/lib-restrict.t line 65. # Looks like you failed 2 tests of 35. t/lib-restrict.t .. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/35 subtests Test Summary Report ------------------- t/lib-restrict.t (Wstat: 512 Tests: 35 Failed: 2) Failed tests: 23, 27 Non-zero exit status: 2 Files=1, Tests=35, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.05 CPU) Result: FAIL
As of v5.18.0, both keys and values stored in %ENV are stringified. On Tue Aug 12 13:44:45 2014, atoomic wrote: Show quoted text
> I suspect that the problem comes from the fact that during the unit > test we use an array ref for $ENV{'lib::restrict-!-d_ok_in'} > which looks to not work with perl 520.0 >
> > perl514 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref $ENV{"foo"}'
> ARRAY
> > perl520 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref $ENV{"foo"}'
> # no return > > note that we have an array in %ENV, looks like to be unblessed ?
> > perl -E '$ENV{"foo"} = [ 1..3 ]; say $ENV{"foo"}; say ref > > $ENV{"foo"}'
> ARRAY(0xb31148) > > > * Error while running the unit test: > > + /usr/bin/make test > PERL_DL_NONLAZY=1 /usr/local/cpanel/3rdparty/perl/520/bin/perl "- > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > t/*.t > > # Failed test '!-d parent exists uid' > # at t/lib-restrict.t line 59. > > # Failed test '!-d parent exists code ref false' > # at t/lib-restrict.t line 65. > # Looks like you failed 2 tests of 35. > t/lib-restrict.t .. > Dubious, test returned 2 (wstat 512, 0x200) > Failed 2/35 subtests > > Test Summary Report > ------------------- > t/lib-restrict.t (Wstat: 512 Tests: 35 Failed: 2) > Failed tests: 23, 27 > Non-zero exit status: 2 > Files=1, Tests=35, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 cusr > 0.00 csys = 0.05 CPU) > Result: FAIL
why not using something like $lib::restrict::d_ok_in and die with a deprecated message when $ENV{'lib::restrict-!-d_ok_in'} is defined ? On Tue Aug 12 13:58:55 2014, atoomic wrote: Show quoted text
> As of v5.18.0, both keys and values stored in %ENV are stringified. > > On Tue Aug 12 13:44:45 2014, atoomic wrote:
> > I suspect that the problem comes from the fact that during the unit > > test we use an array ref for $ENV{'lib::restrict-!-d_ok_in'} > > which looks to not work with perl 520.0 > >
> > > perl514 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref $ENV{"foo"}'
> > ARRAY
> > > perl520 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref $ENV{"foo"}'
> > # no return > > > > note that we have an array in %ENV, looks like to be unblessed ?
> > > perl -E '$ENV{"foo"} = [ 1..3 ]; say $ENV{"foo"}; say ref > > > $ENV{"foo"}'
> > ARRAY(0xb31148) > > > > > > * Error while running the unit test: > > > > + /usr/bin/make test > > PERL_DL_NONLAZY=1 /usr/local/cpanel/3rdparty/perl/520/bin/perl "- > > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > > t/*.t > > > > # Failed test '!-d parent exists uid' > > # at t/lib-restrict.t line 59. > > > > # Failed test '!-d parent exists code ref false' > > # at t/lib-restrict.t line 65. > > # Looks like you failed 2 tests of 35. > > t/lib-restrict.t .. > > Dubious, test returned 2 (wstat 512, 0x200) > > Failed 2/35 subtests > > > > Test Summary Report > > ------------------- > > t/lib-restrict.t (Wstat: 512 Tests: 35 Failed: 2) > > Failed tests: 23, 27 > > Non-zero exit status: 2 > > Files=1, Tests=35, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 cusr > > 0.00 csys = 0.05 CPU) > > Result: FAIL
> >
suggested patch On Tue Aug 12 14:00:30 2014, atoomic wrote: Show quoted text
> why not using something like $lib::restrict::d_ok_in > and die with a deprecated message when $ENV{'lib::restrict-!-d_ok_in'} > is defined ? > > On Tue Aug 12 13:58:55 2014, atoomic wrote:
> > As of v5.18.0, both keys and values stored in %ENV are stringified. > > > > On Tue Aug 12 13:44:45 2014, atoomic wrote:
> > > I suspect that the problem comes from the fact that during the unit > > > test we use an array ref for $ENV{'lib::restrict-!-d_ok_in'} > > > which looks to not work with perl 520.0 > > >
> > > > perl514 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref > > > > $ENV{"foo"}'
> > > ARRAY
> > > > perl520 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref > > > > $ENV{"foo"}'
> > > # no return > > > > > > note that we have an array in %ENV, looks like to be unblessed ?
> > > > perl -E '$ENV{"foo"} = [ 1..3 ]; say $ENV{"foo"}; say ref > > > > $ENV{"foo"}'
> > > ARRAY(0xb31148) > > > > > > > > > * Error while running the unit test: > > > > > > + /usr/bin/make test > > > PERL_DL_NONLAZY=1 /usr/local/cpanel/3rdparty/perl/520/bin/perl "- > > > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > > > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > > > t/*.t > > > > > > # Failed test '!-d parent exists uid' > > > # at t/lib-restrict.t line 59. > > > > > > # Failed test '!-d parent exists code ref false' > > > # at t/lib-restrict.t line 65. > > > # Looks like you failed 2 tests of 35. > > > t/lib-restrict.t .. > > > Dubious, test returned 2 (wstat 512, 0x200) > > > Failed 2/35 subtests > > > > > > Test Summary Report > > > ------------------- > > > t/lib-restrict.t (Wstat: 512 Tests: 35 Failed: 2) > > > Failed tests: 23, 27 > > > Non-zero exit status: 2 > > > Files=1, Tests=35, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 > > > cusr > > > 0.00 csys = 0.05 CPU) > > > Result: FAIL
> > > >
Subject: 0001-stop-using-an-array-ref-in-ENV.patch
From 41a088814e15b5fa4d53ab36855baefcb40d8c4a Mon Sep 17 00:00:00 2001 From: Nicolas Rochelemagne <nicolas.rochelemagne@cpanel.net> Date: Tue, 12 Aug 2014 12:07:40 -0600 Subject: [PATCH] stop using an array ref in ENV --- lib/lib/restrict.pm | 11 +++++++++-- t/lib-restrict.t | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/lib/restrict.pm b/lib/lib/restrict.pm index f76feac..4a7efca 100644 --- a/lib/lib/restrict.pm +++ b/lib/lib/restrict.pm @@ -6,6 +6,8 @@ our $VERSION = '0.0.5'; use base 'lib'; +our $d_ok_in; + sub import { shift; @@ -33,7 +35,12 @@ sub import { $path = lib::_nativize($path); }; # we eval since older lib.pm's don't have this - if(!-d $path && ref $ENV{'lib::restrict-!-d_ok_in'} eq 'ARRAY') { + if ( $ENV{'lib::restrict-!-d_ok_in'} ) { + require Carp; + Carp::carp('$ENV{lib::restrict-!-d_ok_in} is deprecated use $lib::restrict::d_ok_in'); + } + + if(!-d $path && $d_ok_in && ref $d_ok_in eq 'ARRAY') { my $ok = 0; require File::Spec; require File::Basename; @@ -42,7 +49,7 @@ sub import { my $pathless = File::Basename::dirname($absolute); if(File::Spec->file_name_is_absolute($absolute)) { - for my $base (@{ $ENV{'lib::restrict-!-d_ok_in'} }) { + for my $base (@{ $d_ok_in }) { $base = File::Spec->rel2abs($base) if !File::Spec->file_name_is_absolute($base); my $grow = ''; # IE '/' for my $part (File::Spec->splitdir($base)) { diff --git a/t/lib-restrict.t b/t/lib-restrict.t index b72c973..5651b81 100644 --- a/t/lib-restrict.t +++ b/t/lib-restrict.t @@ -51,7 +51,7 @@ SKIP: { eval q{ no lib::restrict 'lib_restrict_array_bad_x'; }; ok($INC[0] eq 'lib_restrict_array_bad_y', 'no lib::restrict'); - BEGIN { $ENV{'lib::restrict-!-d_ok_in'} = ['lib_restrict_nouid']; } + BEGIN { $lib::restrict::d_ok_in = ['lib_restrict_nouid']; } use_ok('lib::restrict', 'lib_restrict_nouid/foo'); ok($INC[0] eq 'lib_restrict_nouid/foo', '!-d parent exists nouid'); -- 1.8.5.2 (Apple Git-48)
thanks! On Tue Aug 12 14:08:32 2014, atoomic wrote: Show quoted text
> suggested patch > > On Tue Aug 12 14:00:30 2014, atoomic wrote:
> > why not using something like $lib::restrict::d_ok_in > > and die with a deprecated message when $ENV{'lib::restrict-!-d_ok_in'} > > is defined ? > > > > On Tue Aug 12 13:58:55 2014, atoomic wrote:
> > > As of v5.18.0, both keys and values stored in %ENV are stringified. > > > > > > On Tue Aug 12 13:44:45 2014, atoomic wrote:
> > > > I suspect that the problem comes from the fact that during the unit > > > > test we use an array ref for $ENV{'lib::restrict-!-d_ok_in'} > > > > which looks to not work with perl 520.0 > > > >
> > > > > perl514 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref > > > > > $ENV{"foo"}'
> > > > ARRAY
> > > > > perl520 -E 'BEGIN { $ENV{"foo"} = [ 1..3 ] }; say ref > > > > > $ENV{"foo"}'
> > > > # no return > > > > > > > > note that we have an array in %ENV, looks like to be unblessed ?
> > > > > perl -E '$ENV{"foo"} = [ 1..3 ]; say $ENV{"foo"}; say ref > > > > > $ENV{"foo"}'
> > > > ARRAY(0xb31148) > > > > > > > > > > > > * Error while running the unit test: > > > > > > > > + /usr/bin/make test > > > > PERL_DL_NONLAZY=1 /usr/local/cpanel/3rdparty/perl/520/bin/perl "- > > > > MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef > > > > *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" > > > > t/*.t > > > > > > > > # Failed test '!-d parent exists uid' > > > > # at t/lib-restrict.t line 59. > > > > > > > > # Failed test '!-d parent exists code ref false' > > > > # at t/lib-restrict.t line 65. > > > > # Looks like you failed 2 tests of 35. > > > > t/lib-restrict.t .. > > > > Dubious, test returned 2 (wstat 512, 0x200) > > > > Failed 2/35 subtests > > > > > > > > Test Summary Report > > > > ------------------- > > > > t/lib-restrict.t (Wstat: 512 Tests: 35 Failed: 2) > > > > Failed tests: 23, 27 > > > > Non-zero exit status: 2 > > > > Files=1, Tests=35, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.02 > > > > cusr > > > > 0.00 csys = 0.05 CPU) > > > > Result: FAIL
> > > > > >
> >
ping