Skip Menu |

This queue is for tickets about the Lexical-Failure CPAN distribution.

Report information
The Basics
Id: 87496
Status: resolved
Priority: 0/
Queue: Lexical-Failure

People
Owner: Nobody in particular
Requestors: doran [...] bluehost.com
Cc:
AdminCc:

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



Subject: Tests failing
Date: Wed, 31 Jul 2013 14:41:13 -0600
To: bug-Lexical-Failure [...] rt.cpan.org
From: "Doran L. Barton" <doran [...] bluehost.com>
Some tests are failing. This is on Fedora 19 (x86_64), but some of my coworkers have said tests are failing for them too (Ubuntu, maybe): t/inner_scalar.t .......... 1/10 # Failed test 'Warned as expected at line ' # at t/inner_scalar.t line 10. # 'Variable "$errmsg" is not available at t/inner_scalar.t line 23. # ' # doesn't match '(?^x:\A Lexical \s \S+ \ used\ as\ failure\ handler\ may\ not\ stay\ shared\ at\ runtime)' Use of uninitialized value in concatenation (.) or string at t/inner_scalar.t line 10. # Failed test 'Warned as expected at line ' # at t/inner_scalar.t line 10. # 'Variable "$errmsg" is not available at t/inner_scalar.t line 40. # ' # doesn't match '(?^x:\A Lexical \s \S+ \ used\ as\ failure\ handler\ may\ not\ stay\ shared\ at\ runtime)' # Failed test 'Warned unexpectedly: Variable "@errmsg" is not available at t/inner_scalar.t line 61. # ' # at t/inner_scalar.t line 52. # Looks like you planned 10 tests but ran 13. # Looks like you failed 3 tests of 13 run. t/inner_scalar.t .......... Dubious, test returned 3 (wstat 768, 0x300) Failed 3/10 subtests -- Doran L. Barton <doran@bluehost.com> - Senior Developer, Bluehost, RHCE "The flattening of underwear with pleasure is the job of the chambermaid." -- Seen in a Yugoslavian hotel
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Wed, 31 Jul 2013 13:54:09 -0700
To: bug-Lexical-Failure [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Hi Doran. Thanks for the report. Under which version of perl are these failures this occurring? (I've tested it successfully on 5.14.3, 5.18.0, and 5.19.2) Damian
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Wed, 31 Jul 2013 16:46:07 -0600
To: bug-Lexical-Failure [...] rt.cpan.org
From: "Doran L. Barton" <doran [...] bluehost.com>
On Wed, 31 Jul 2013 16:55:00 -0400 "damian@conway.org via RT" <bug-Lexical-Failure@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=87496 > > > Hi Doran. > > Thanks for the report. > > Under which version of perl are these failures this occurring? > (I've tested it successfully on 5.14.3, 5.18.0, and 5.19.2) > > Damian >
This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi -- Doran L. Barton <doran@bluehost.com> - Senior Developer, Bluehost, RHCE "Teeth extracted by the latest Methodists." -- In an advertisement by a Hong Kong dentist
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Wed, 31 Jul 2013 16:19:03 -0700
To: bug-Lexical-Failure [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> This is perl 5, version 16, subversion 3 (v5.16.3) built for > x86_64-linux-thread-multi
Hmmmmm. I just installed and tested under that version...without problems. But not with ithreads or multiplicity defined, so that might be the problem. The "error" is simply that your version is detecting the same problem but throwing a different error message. So, could I ask you to test the following version of t/inner_scalar.t. If it passes, I'll upload a new release with this "more flexible" test. Thanks! Damian -----cut----------cut----------cut----------cut----------cut----------cut----------cut----- use Test::Effects tests => 10; use 5.014; use lib 'tlib'; my $warned; sub _check_warning { like "@_", qr{ \A Variable \s \S+ \s \Qis not available\E | \A Lexical \s \S+ \Q used as failure handler may not stay shared at runtime\E }x => 'Warned as expected at line ' . (caller 4)[2]; $warned = 1; } BEGIN { $SIG{__WARN__} = \&_check_warning; } { subtest 'fail --> my inner scalar', sub { plan tests => 2; my $errmsg; use TestModule errors => \$errmsg; BEGIN{ if (!$warned) { fail 'Did not warn as expected' } ok $warned => 'Warning given'; $warned = 0 } effects_ok { TestModule::dont_succeed() } { return => undef } => 'Correct effects'; is $errmsg, undef() => 'Failed to bind, as expected'; }; } { subtest 'fail --> my inner hash', sub { plan tests => 2; my $errmsg; use TestModule errors => ($errmsg = {}); BEGIN{ if (!$warned) { fail 'Did not warn as expected' } ok $warned => 'Warning given'; $warned = 0 } effects_ok { TestModule::dont_succeed() } { return => undef } => 'Correct effects'; ok ref($errmsg) ne 'HASH' || !keys $errmsg => 'Failed to bind, as expected'; }; } BEGIN { $SIG{__WARN__} = sub { fail "Warned unexpectedly: @_"; } } # Note: ideally the following would also warn when inner array used, but # there doesn't seem to be any way to actually detect the problem. :-( { subtest 'fail --> my inner array', sub { plan tests => 2; my @errmsg; use TestModule errors => \@errmsg; effects_ok { TestModule::dont_succeed() } { return => undef } => 'Correct effects'; ok !@errmsg => 'Failed to bind, as expected'; }; } my $outer_var; { subtest 'fail --> my outer scalar', sub { plan tests => 2; use TestModule errors => \$outer_var; effects_ok { TestModule::dont_succeed() } { return => undef } => 'Correct effects'; is_deeply $outer_var, ["Didn't succeed"] => 'Successfully bound, as expected'; }; } { subtest 'fail --> our package scalar', sub { plan tests => 2; our $error; use TestModule errors => \$error; effects_ok { TestModule::dont_succeed() } { return => undef } => 'Correct effects'; is_deeply $error, ["Didn't succeed"] => 'Successfully bound, as expected'; }; } { subtest 'fail --> qualified package scalar', sub { plan tests => 2; use TestModule errors => \$Other::var; effects_ok { TestModule::dont_succeed() } { return => undef } => 'Correct effects'; is_deeply $Other::var, ["Didn't succeed"] => 'Successfully bound, as expected'; }; }
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Wed, 31 Jul 2013 17:38:50 -0600
To: bug-Lexical-Failure [...] rt.cpan.org
From: "Doran L. Barton" <doran [...] bluehost.com>
On Wed, 31 Jul 2013 19:19:58 -0400 "damian@conway.org via RT" <bug-Lexical-Failure@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=87496 > >
> > This is perl 5, version 16, subversion 3 (v5.16.3) built for > > x86_64-linux-thread-multi
> > Hmmmmm. I just installed and tested under that version...without > problems. But not with ithreads or multiplicity defined, so that > might be the problem. The "error" is simply that your version is > detecting the same problem but throwing a different error message. > So, could I ask you to test the following version of > t/inner_scalar.t. If it passes, I'll upload a new release with this > "more flexible" test.
Just tried that... no go: t/inner_scalar.t .......... Use of uninitialized value in concatenation (.) or string at t/inner_scalar.t line 10. t/inner_scalar.t .......... 1/10 # Failed test 'Warned as expected at line 26' # at t/inner_scalar.t line 10. # 'Lexical scalar used as failure handler may not stay shared at runtime at /tmp/Lexical-Failure-0.000003/blib/lib/Lexical/Failure.pm line 231. # Lexical::Failure::_check_scoping_of('SCALAR(0x2c66c18)') called at /tmp/Lexical-Failure-0.000003/blib/lib/Lexical/Failure.pm line 164 # Lexical::Failure::ON_FAILURE('SCALAR(0x2c66c18)') called at tlib/TestModule.pm line 15 # TestModule::import('TestModule', 'errors', 'SCALAR(0x2c66c18)') called at t/inner_scalar.t line 26 # main::BEGIN() called at t/inner_scalar.t line 26 # eval {...} called at t/inner_scalar.t line 26 # ' # doesn't match '(?^ux: \A Variable \s \S+ \s is\ not\ available # | \A Lexical \s \S+ \ used\ as\ failure\ handler\ may\ # not\ stay\ shared\ at\ runtime # )' Use of uninitialized value in concatenation (.) or string at t/inner_scalar.t line 10. # Failed test 'Warned as expected at line 44' # at t/inner_scalar.t line 10. # 'Lexical hash used as failure handler may not stay shared at runtime at /tmp/Lexical-Failure-0.000003/blib/lib/Lexical/Failure.pm line 231. # Lexical::Failure::_check_scoping_of('HASH(0x2c6b768)') called at /tmp/Lexical-Failure-0.000003/blib/lib/Lexical/Failure.pm line 164 # Lexical::Failure::ON_FAILURE('HASH(0x2c6b768)') called at tlib/TestModule.pm line 15 # TestModule::import('TestModule', 'errors', 'HASH(0x2c6b768)') called at t/inner_scalar.t line 44 # main::BEGIN() called at t/inner_scalar.t line 44 # eval {...} called at t/inner_scalar.t line 44 # ' # doesn't match '(?^ux: \A Variable \s \S+ \s is\ not\ available # | \A Lexical \s \S+ \ used\ as\ failure\ handler\ may\ # not\ stay\ shared\ at\ runtime # )' # Failed test 'Warned unexpectedly: Variable "@errmsg" is not available at t/inner_scalar.t line 67. # ' # at t/inner_scalar.t line 58. # Looks like you planned 10 tests but ran 13. # Looks like you failed 3 tests of 13 run. t/inner_scalar.t .......... Dubious, test returned 3 (wstat 768, 0x300) Failed 3/10 subtests -- Doran L. Barton <doran@bluehost.com> - Senior Developer, Bluehost, RHCE "Don't drink a car under the influence of alcohol!!" -- Seen in a bar in Japan
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Wed, 31 Jul 2013 16:54:59 -0700
To: bug-Lexical-Failure [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Grrrrr! Gmail or RT wrapped the source code I sent. I'm going to send it to you off thread Doran and we can see if that works. Damian
RT-Send-CC: damian [...] conway.org
These failures are caused by the "not available" warnings generated by perl for the construct : my $code = sub { my $x; BEGIN { $x } } because the anonymous sub doesn't exist at the time the BEGIN block is executed, so it can't refer to a lexical of this anon sub. The errors may seem intermittent because some versions of Test::Harness enforce -w on the test script, while others don't. It can be reliably reproduced by putting an "use warnings" at the top of t/inner_scalar.t Vincent
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Thu, 1 Aug 2013 22:34:28 -0600
To: bug-Lexical-Failure [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> These failures are caused by the "not available" warnings generated by perl for the construct : > > my $code = sub { > my $x; > BEGIN { $x } > }
Much appreciated, Vincent! It's so obvious once you pointed it out. %-) I will work on a fix in the next day or so. Thanks so much for tracking this down for me. Damian
Subject: Re: [rt.cpan.org #87496] Tests failing
Date: Fri, 2 Aug 2013 18:50:17 -0600
To: bug-Lexical-Failure [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Finally fixed (I hope!) New release uploaded to CPAN just now. Many thanks to everyone who helped track this problem down, especially Doran and Vincent. Much appreciated, Damian