Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Funky Test Failure, How to Correct

by einhverfr (Friar)
on Feb 23, 2014 at 13:53 UTC ( #1075891=perlquestion: print w/replies, xml ) Need Help??
einhverfr has asked for the wisdom of the Perl Monks concerning the following question:


I have gotten a really odd test failure on for PGObject::Type::DateTime. I am not sure if there is anything I can do to keep it from happening again (I really try hard to avoid having any test failures there). It only seems to happen on systems with the exact same software versions as the tester reports. For all I know the failure I saw in 1.00 and the one I saw in 1.00.001 could be from the same system. So it might be only one system failing for all I know.

Perl seems to be complaining about taint mode and the following line in DateTime::Timezone::Floating:

use parent 'Class::Singleton', 'DateTime::TimeZone::OffsetOnly';

(assuming that the module is the same there as on other systems).

I think that it is clear the problem is fairly deep in the dependency tree, so my thinking is that it might be good to test for being able to load the DateTime::TimeZone::Floating module under taint mode and skip the load test if that fails. I am worried about the fact that this might expose other bugs down the line for some users however.

What other options do I have?

Edit: It does look like the same tester in both this and the earlier failure that prompted it.

Update: So this is specific to one (or so) Perl 5.19.6 system. Since 5.19.6 is a development release, I am going to treat it as a Perl bug. I am going to assume that a tester running a development release is doing so for reasons of testing the Perl version as much as anything else and will follow up with him for the narrow purpose of reporting this as a possible Perl 5.19 issue.

Replies are listed 'Best First'.
Re: Funky Test Failure, How to Correct
by kcott (Chancellor) on Feb 24, 2014 at 07:41 UTC

      Thanks for your reply. It is helpful.

      Looking at the line (in a dependency) that is throwing the error and the documentation, I am entirely hard-pressed to see this as deliberate. The line which is throwing the error is, again,

      use parent 'Class::Singleton', 'DateTime::TimeZone::OffsetOnly';

      There is nothing dynamic in either string. There is no pattern matching going on. And the same tests are passed on two other 5.19.9 systems. If this is a deliberate change, it is not conforming to any reasonable interpretation of the documentation I can think of.

Re: Funky Test Failure, How to Correct
by DrHyde (Prior) on Feb 24, 2014 at 11:05 UTC
    The CPAN-testers test with dev release of perl for two reasons. Yes, one is to find bugs in perl before official releases. However, we also do it so that module authors get advance notice of changes that will affect their code when the next version of perl is released. Judging by what kcott says, this change is deliberate, and the failure is because of a bugfix in perl where you were inadvertently relying on the old buggy behaviour.

      Ok, getting back to the line I posted (which is in DateTime::TimeZone::Floating, not my own code), there's nothing in the documentation which suggests that this failure in this line is deliberate. After all it is just a "use parent" statement and has no wildcards or patterns in it.

      Given that there is nothing dynamic in the strings involved, given that they work everywhere else (including two other Perl 5.19.9 systems run by the same tester on different versions of FreeBSD), this either has to be a bug in Perl (or a dependency linked to somewhere) or it has to be a broken parent pragma (which iirc ships with core).

      My reason for contacting the tester in this case was to hand off what tracing I had managed to do so that if he was interested in taking it further he wouldn't have to duplicate my work. That a deliberate change occurs in related areas of code (tainting) in no way means that new bugs aren't introduced in that process.

      and the failure is because of a bugfix in perl where you were inadvertently relying on the old buggy behaviour.

      Sure its not :) maybe

      Look at the error message stacktrace, looks very much like something in the DateTime:: namespace originates the message not the OPs module itself

Re: Funky Test Failure, How to Correct
by Khen1950fx (Canon) on Feb 23, 2014 at 18:40 UTC
    FWIW, all your tests passed for me; however, to prevent these type of failures, you could do something like this:
    #!perl -T use strict; use lib qw(blib/arch blib/lib); use Test::More tests => 1; BEGIN { use_ok( 'PGObject::Type::DateTime' ) || print "Bail out!\n"; } diag( "Testing PGObject::Type::DateTime $PGObject::Type::DateTime::VER +SION, Perl $], $^X" );
    I used lib because perl doesn't see PERL5LIB under taint.

      to prevent these type of failures, you could do something like this

      Unlikely to make any difference here

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1075891]
Front-paged by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2018-03-23 13:31 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (293 votes). Check out past polls.