List Info

Thread: Perl Storable2.16 Bug?




Perl Storable2.16 Bug?
user name
2007-05-30 18:34:26
Hi, I think I found a bug(ish) in Storable, if you use freeze/nfreeze to store a CODEREF (subroutine) and use warnings is set then it fails (an example) on thaw with:
code sub {
    use warnings;
    use strict 'refs';
 ;   print "Testn";
} caused an error: 'caller' trapped by operation mask at C:/PERL/lib/Carp.pm line 233.
Compilation failed in require at C:/PERL/lib/warnings.pm line 134.
BEGIN failed--compilation aborted at C:/PERL/lib/warnings.pm line 134.
Compilation failed in require at (eval 12) line 2.
BEGIN failed--compilation aborted at (eval 12) line 2, at client.pl line 55
Whereas it works perfectly without use warnings.  I have attached a short perl file that shows the problem (taken from the Storable module description) where it will fail with warnings in and succeed with warnings out (I think it relates to Storable treating all warnings as errors).

Thanks for the great module!!!
Matt Spear
batman900gmail.com">batman900gmail.com
  
Re: Perl Storable2.16 Bug?
user name
2007-05-31 18:46:46
On 5/30/07, Matt Spear <batman900gmail.com> wrote:
> Hi, I think I found a bug(ish) in Storable, if you use
freeze/nfreeze to

Aha! Per your other email I've just read your attachment.
It's easy to
not notice attachments in gmail. Your fix is to change your
safe to
allow the caller opcode or perhaps upgrade to a newer
warnings.pm
which does not use() Carp.

It is legitimate for Safe to reject that code because it
uses a
disallowed opcode. It is also legitimate to use Carp and
other
call-stack using code in warnings.pm. It's just when you
combine the
two that you've got pain. I just suspect Safe-using code
will have to
adapt to allow  anything required as pragmas in deparsed
code.

For typical code this means Safe.pm ought to pass all
opcodes used by
strict.pm and warnings.pm. I'm not sure if Safe.pm's default
ruleset
should be adjusted to add caller() or if this is something
to expect
users to do. caller() in blead returns something %^H-like
too. I don't
recall whether that is writeable or not or whether there
are
information leaks.

Josh

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )