r39419 - in /trunk/libautodie-perl: AUTHORS Changes MANIFEST META.yml debian/changelog lib/Fatal.pm lib/autodie.pm lib/autodie/exception.pm lib/autodie/exception/system.pm lib/autodie/hints.pm t/string-eval-basic.t t/string-eval-leak.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Mon Jul 6 17:27:48 UTC 2009
Author: jawnsy-guest
Date: Mon Jul 6 17:27:42 2009
New Revision: 39419
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=39419
Log:
* New upstream release
+ Some bugfixes and new tests
Added:
trunk/libautodie-perl/t/string-eval-basic.t
trunk/libautodie-perl/t/string-eval-leak.t
Modified:
trunk/libautodie-perl/AUTHORS
trunk/libautodie-perl/Changes
trunk/libautodie-perl/MANIFEST
trunk/libautodie-perl/META.yml
trunk/libautodie-perl/debian/changelog
trunk/libautodie-perl/lib/Fatal.pm
trunk/libautodie-perl/lib/autodie.pm
trunk/libautodie-perl/lib/autodie/exception.pm
trunk/libautodie-perl/lib/autodie/exception/system.pm
trunk/libautodie-perl/lib/autodie/hints.pm
Modified: trunk/libautodie-perl/AUTHORS
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/AUTHORS?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/AUTHORS (original)
+++ trunk/libautodie-perl/AUTHORS Mon Jul 6 17:27:42 2009
@@ -78,3 +78,13 @@
Toby Corkindale
- Documentation copyediting and improvements.
+
+Vincent Pit
+ - Additional test cases.
+ - Help in tracking down string eval weirdness.
+ - Code review and sanity support.
+
+Florian Ragwitz
+ - Help in tracking down string eval weirdness.
+ - Letting me cargo-cult code from B::Hooks::EndOfScope.
+
Modified: trunk/libautodie-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/Changes?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/Changes (original)
+++ trunk/libautodie-perl/Changes Mon Jul 6 17:27:42 2009
@@ -1,4 +1,21 @@
Revision history for autodie
+
+2.06 Tue Jul 7 00:01:37 AUSEST 2009
+
+ * BUG: Explicitly documented that autodie does NOT play
+ nicely with string evals, especially under Perl 5.10.x.
+ Please avoid using string evals while autodie is in scope.
+
+ * TEST: Check for autodie leaking out of scope in the
+ presence of string evals. (string-eval-leak.t)
+ Thanks to Florian Ragwitz and Vincent Pit for identifying
+ this.
+
+ * BUGFIX: autodie once again correctly works when used
+ inside a string eval. (This was accidently broken
+ somewhere around 1.997-1.998).
+
+2.05 Sat Jul 4 16:33:01 AUSEST 2009
* BUGFIX: format_default() in autodie::exception no longer
returns a string with file and line attached. This would
Modified: trunk/libautodie-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/MANIFEST?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/MANIFEST (original)
+++ trunk/libautodie-perl/MANIFEST Mon Jul 6 17:27:42 2009
@@ -75,6 +75,8 @@
t/repeat.t
t/scope_leak.t
t/socket.t
+t/string-eval-basic.t
+t/string-eval-leak.t
t/sysopen.t
t/system.t
t/truncate.t
Modified: trunk/libautodie-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/META.yml?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/META.yml (original)
+++ trunk/libautodie-perl/META.yml Mon Jul 6 17:27:42 2009
@@ -27,4 +27,4 @@
bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=autodie
license: http://dev.perl.org/licenses/
repository: http://github.com/pfenwick/autodie/tree/master
-version: 2.05
+version: 2.06
Modified: trunk/libautodie-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/debian/changelog?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/debian/changelog (original)
+++ trunk/libautodie-perl/debian/changelog Mon Jul 6 17:27:42 2009
@@ -1,3 +1,10 @@
+libautodie-perl (2.06-1) UNRELEASED; urgency=low
+
+ * New upstream release
+ + Some bugfixes and new tests
+
+ -- Jonathan Yu <frequency at cpan.org> Mon, 06 Jul 2009 09:31:02 -0400
+
libautodie-perl (2.05-1) unstable; urgency=low
* New upstream release
Modified: trunk/libautodie-perl/lib/Fatal.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/Fatal.pm?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/Fatal.pm (original)
+++ trunk/libautodie-perl/lib/Fatal.pm Mon Jul 6 17:27:42 2009
@@ -39,7 +39,7 @@
use constant MIN_IPC_SYS_SIMPLE_VER => 0.12;
# All the Fatal/autodie modules share the same version number.
-our $VERSION = '2.05';
+our $VERSION = '2.06';
our $Debug ||= 0;
@@ -100,6 +100,7 @@
':2.03' => [qw(:default)],
':2.04' => [qw(:default)],
':2.05' => [qw(:default)],
+ ':2.06' => [qw(:default)],
);
$TAGS{':all'} = [ keys %TAGS ];
@@ -1086,9 +1087,18 @@
my \$caller_level = 0;
- while ( (caller \$caller_level)[1] =~ m{^\\(eval \\d+\\)\$} ) {
+ my \$caller;
+
+ while ( (\$caller = (caller \$caller_level)[1]) =~ m{^\\(eval \\d+\\)\$} ) {
+
+ # If our filename is actually an eval, and we
+ # reach it, then go to our autodying code immediatately.
+
+ goto &\$code if (\$caller eq \$filename);
\$caller_level++;
}
+
+ # We're now out of the eval stack.
# If we're called from the correct file, then use the
# autodying code.
Modified: trunk/libautodie-perl/lib/autodie.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie.pm?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie.pm (original)
+++ trunk/libautodie-perl/lib/autodie.pm Mon Jul 6 17:27:42 2009
@@ -8,7 +8,7 @@
our $VERSION;
BEGIN {
- $VERSION = '2.05';
+ $VERSION = '2.06';
}
use constant ERROR_WRONG_FATAL => q{
@@ -351,11 +351,6 @@
is used with package filehandles (eg, C<FILE>). Scalar filehandles are
strongly recommended instead.
-Under Perl 5.8 only, C<autodie> I<does not> propagate into string C<eval>
-statements, although it can be explicitly enabled inside a string
-C<eval>. This bug does not affect block C<eval> statements in
-any version of Perl.
-
When using C<autodie> or C<Fatal> with user subroutines, the
declaration of those subroutines must appear before the first use of
C<Fatal> or C<autodie>, or have been exported from a module.
@@ -365,6 +360,31 @@
Due to a bug in Perl, C<autodie> may "lose" any format which has the
same name as an autodying built-in or function.
+C<autodie> may not work correctly if used inside a file with a
+name that looks like a string eval, such as F<eval (3)>.
+
+=head2 autodie and string eval
+
+Due to the current implementation of C<autodie>, unexpected results
+may be seen when used near or with the string version of eval.
+I<None of these bugs exist when using block eval>.
+
+Under Perl 5.8 only, C<autodie> I<does not> propagate into string C<eval>
+statements, although it can be explicitly enabled inside a string
+C<eval>.
+
+Under Perl 5.10 only, C<autodie> I<does not> operate correctly when
+used inside a string C<eval>.
+
+Under Perl 5.10 only, using a string eval when C<autodie> is in
+effect can cause the autodie behaviour to leak into the surrounding
+scope. This can be worked around by using a C<no autodie> at the
+end of the scope to explicitly remove autodie's effects, or by
+avoiding the use of string eval.
+
+I<None of these bugs exist when using block eval>. The use of
+C<autodie> with block eval is considered good practice.
+
=head2 REPORTING BUGS
Please report bugs via the CPAN Request Tracker at
Modified: trunk/libautodie-perl/lib/autodie/exception.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie/exception.pm?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie/exception.pm (original)
+++ trunk/libautodie-perl/lib/autodie/exception.pm Mon Jul 6 17:27:42 2009
@@ -14,7 +14,7 @@
use if ($] >= 5.010), overload => '~~' => "matches";
-our $VERSION = '2.05';
+our $VERSION = '2.06';
my $PACKAGE = __PACKAGE__; # Useful to have a scalar for hash keys.
Modified: trunk/libautodie-perl/lib/autodie/exception/system.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie/exception/system.pm?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie/exception/system.pm (original)
+++ trunk/libautodie-perl/lib/autodie/exception/system.pm Mon Jul 6 17:27:42 2009
@@ -5,7 +5,7 @@
use base 'autodie::exception';
use Carp qw(croak);
-our $VERSION = '2.05';
+our $VERSION = '2.06';
my $PACKAGE = __PACKAGE__;
Modified: trunk/libautodie-perl/lib/autodie/hints.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/lib/autodie/hints.pm?rev=39419&op=diff
==============================================================================
--- trunk/libautodie-perl/lib/autodie/hints.pm (original)
+++ trunk/libautodie-perl/lib/autodie/hints.pm Mon Jul 6 17:27:42 2009
@@ -5,7 +5,7 @@
use constant PERL58 => ( $] < 5.009 );
-our $VERSION = '2.05';
+our $VERSION = '2.06';
=head1 NAME
Added: trunk/libautodie-perl/t/string-eval-basic.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/t/string-eval-basic.t?rev=39419&op=file
==============================================================================
--- trunk/libautodie-perl/t/string-eval-basic.t (added)
+++ trunk/libautodie-perl/t/string-eval-basic.t Mon Jul 6 17:27:42 2009
@@ -1,0 +1,24 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+use Test::More tests => 3;
+
+use constant NO_SUCH_FILE => 'this_file_had_better_not_exist';
+
+# Keep this test alone in its file as it can be hidden by using autodie outside
+# the eval.
+
+# Just to make sure we're absolutely not encountering any weird $@ clobbering
+# events, we'll capture a result from our string eval.
+
+my $result = eval q{
+ use autodie "open";
+
+ open(my $fh, '<', NO_SUCH_FILE);
+
+ 1;
+};
+
+ok( ! $result, "Eval should fail with autodie/no such file");
+ok($@, "enabling autodie in string eval should throw an exception");
+isa_ok($@, 'autodie::exception');
Added: trunk/libautodie-perl/t/string-eval-leak.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libautodie-perl/t/string-eval-leak.t?rev=39419&op=file
==============================================================================
--- trunk/libautodie-perl/t/string-eval-leak.t (added)
+++ trunk/libautodie-perl/t/string-eval-leak.t Mon Jul 6 17:27:42 2009
@@ -1,0 +1,39 @@
+#!/usr/bin/perl -w
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+# Under Perl 5.10.x, a string eval can cause a copy to be taken of
+# %^H, which delays stringification of our scope guard objects,
+# which in turn causes autodie to leak. These tests check to see
+# if we've successfully worked around this issue.
+
+eval {
+
+ {
+ use autodie;
+ eval "1";
+ }
+
+ open(my $fh, '<', 'this_file_had_better_not_exist');
+};
+
+TODO: {
+ local $TODO;
+
+ if ( $] >= 5.010 ) {
+ $TODO = "Autodie can leak near string evals in 5.10.x";
+ }
+
+ is("$@","","Autodie should not leak out of scope");
+}
+
+# However, we can plug the leak with 'no autodie'.
+
+no autodie;
+
+eval {
+ open(my $fh, '<', 'this_file_had_better_not_exist');
+};
+
+is("$@","",'no autodie should be able to workaround this bug');
More information about the Pkg-perl-cvs-commits
mailing list