Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Simple CPAN distribution.

Report information
The Basics
Id: 43391
Status: resolved
Priority: 0/
Queue: Test-Simple

People
Owner: Nobody in particular
Requestors: skasal [...] redhat.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in:
  • 0.85_01
  • 0.86
Fixed in: (no value)



Subject: T::B dies if the test corrupts @INC
If the test corrupts @INC, e.g. @INC=(), then T::B gets confused and dies. This is a real-life problem, triggered by Test-Harness-3.14/t/compat/regression.t . (The test was fixed in Test-Harness-3.15.) The problem has been introduced by the following commit http://github.com/schwern/test-more/commit/9c56ac75f0097f1f219937594eb3bc15c93f6224#diff-0 The first chunk of the diff is the reason of this issue: the former "||return" was replaced by option "die_on_fail". Please consider applying the patch attached.
Subject: 0001-Test-Builder-do-not-die-if-the-test-corrupted-INC.patch
From b3e15fbe90377db95e5f404b648b06aca05b5758 Mon Sep 17 00:00:00 2001 From: Stepan Kasal <skasal@redhat.com> Date: Wed, 18 Feb 2009 12:00:35 +0100 Subject: [PATCH] Test::Builder: do not die if the test corrupted @INC --- lib/Test/Builder.pm | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/Test/Builder.pm b/lib/Test/Builder.pm index 8a969bf..6205d61 100644 --- a/lib/Test/Builder.pm +++ b/lib/Test/Builder.pm @@ -548,7 +548,7 @@ sub _unoverload { my $self = shift; my $type = shift; - $self->_try(sub { require overload; }, die_on_fail => 1); + $self->_try(sub { require overload; }); foreach my $thing (@_) { if( $self->_is_object($$thing) ) { -- 1.6.0.6
RT-Send-CC: BMORROW [...] cpan.org
To spread the word -- also affected is Data::PostfixDeref. Fails with 0.86, downgrading Test-Simple to 0.84 resolves and applying the patch resolves too. HTH
Hosing @INC is not safe, period. This is not something specific to Test::Builder, anything can load a module at run-time. Here is a simple example: $ cat Foo.pm package Foo; sub test { require Text::Soundex; } 1; $ perl -wle 'use Foo; @INC = (); Foo::test()' Can't locate Text/Soundex.pm in @INC (@INC contains:) at Foo.pm line 4. If Test::Builder didn't fail something else would. (I patched that Test::Harness test, btw). The Data::PostfixDeref problem just highlights why the change was made to make the require die. Here's the output with 0.86. $ perl -Mblib -w t/01basic.t 1..29 Unmatched right curly bracket at /usr/local/perl/5.10.0/lib/5.10.0/overload.pm line 163, at end of line syntax error at /usr/local/perl/5.10.0/lib/5.10.0/overload.pm line 163, near "}" syntax error at /usr/local/perl/5.10.0/lib/5.10.0/overload.pm line 171, near "}" Compilation failed in require at /usr/local/perl/5.10.0/lib/5.10.0/Test/Builder.pm line 551. # Looks like your test exited with 255 before it could output anything Let's see that again without Test::Builder... $ perl -Mblib -wle 'use Data::PostfixDeref; use overload' Unmatched right curly bracket at /usr/local/perl/5.10.0/lib/5.10.0/overload.pm line 163, at end of line syntax error at /usr/local/perl/5.10.0/lib/5.10.0/overload.pm line 163, near "}" syntax error at /usr/local/perl/5.10.0/lib/5.10.0/overload.pm line 171, near "}" Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1. By not dying 0.84 was hiding the fact that Data::PostfixDeref hoses overload.pm. 0.86 reveals a bug that 0.84 hid. This is not a bug but fixage. http://www.nntp.perl.org/group/perl.qa/2008/03/msg10460.html Sorry for the inconvenience, but I'm going to mark this ticket as rejected/not-a-bug. Feel free to reopen it if you feel this isn't satisfactory.
Oh, thank you for the report and patch. Even though it turned out to be rejected, it took me a bit of digging to figure out what was going on and that it is in fact not a bug.
Subject: Re: [rt.cpan.org #43391] T::B dies if the test corrupts @INC
Date: Thu, 26 Feb 2009 11:52:24 +0100
To: Michael G Schwern via RT <bug-Test-Simple [...] rt.cpan.org>
From: Stepan Kasal <kasal [...] ucw.cz>
Hello, Show quoted text
> Oh, thank you for the report and patch. Even though it turned out to be > rejected, it took me a bit of digging to figure out what was going on > and that it is in fact not a bug.
thank you for handling this. I was not sure which of the ends should be fixed, so relied on your guidance. I'm glad you prtected the code from my mis-fix. I just wanted to tell someone the story after spending a few hours analyzing this. ;-) Stepan
Re-resolve.