Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 57224
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: UNERA [...] cpan.org
Cc:
AdminCc:

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



Subject: CGI::Carp works incorrectly if we have an exception in a package of one of parents
Debian bugreport: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=580356 Today I've found an unpleasant bug in CGI::Carp. In attache You can find test script showing the problem. If we have more than one packages in parent list, and one of them throws an exception from BEGIN section, CGI::Carp can't detect $@ error-text properly. If You start test.pl You will see the following error-text: ... [Wed May 5 15:33:31 2010] test.pl: Died at /usr/share/perl/5.10/base.pm line 93. [Wed May 5 15:33:31 2010] test.pl: BEGIN failed--compilation aborted at Package1.pm line 5. Compilation failed in require at test.pl line 11. If You comment text 'use CGI::Carp' You can see the following text: 123 at Package3.pm line 12. Compilation failed in require at (eval 3) line 3. ...propagated at /usr/share/perl/5.10/base.pm line 93. BEGIN failed--compilation aborted at Package1.pm line 5. Compilation failed in require at test.pl line 11. This bug appears only if we have more than one packages in parent-list.
Subject: eval.tgz
Download eval.tgz
application/x-gzip 417b

Message body not shown because it is not plain text.

Download (untitled) / with headers
text/plain 366b
I only had time to quickly throw a look at it, but it seems that the problem has to do with the fact that 'base' also muck with the 'die' sighandler. In base.pm, the crux seems to be in the 'import' function. I'll have to dig deeper to say something more enlightning, but it could be a case where the fix for this corner case might be a rather big headache.
Download (untitled) / with headers
text/plain 839b
Срд Май 05 10:35:44 2010, YANICK писал: Show quoted text
> I only had time to quickly throw a look at it, > but it seems that the problem has to do with the fact that > 'base' also muck with the 'die' sighandler. > > In base.pm, the crux seems to be in the 'import' function. > > I'll have to dig deeper to say something more enlightning, > but it could be a case where the fix for this corner case > might be a rather big headache.
No :) I think this is the CGI::Carp's bug, not in 'base'. In attache You can find another script showes this problem. There is no dependencises exclude CGI::Carp. If we use CGI::Carp, we can see the following error-text: <h1>Software error:</h1> <pre> at test.pl line 18.</pre> If we comment 'use CGI::Carp', we can see properly error-text: 123 at test.pl line 13. ...propagated at test.pl line 18.
Subject: test.pl
Download test.pl
text/x-perl 174b
#!/usr/bin/perl use warnings; use strict; use utf8; use open qw(:std :utf8); use CGI::Carp qw(fatalsToBrowser); sub foo() { die 123; } eval { foo(); }; die if $@;
Subject: Re: [rt.cpan.org #57224] CGI::Carp works incorrectly if we have an exception in a package of one of parents
Date: Thu, 6 May 2010 19:50:41 -0400
To: bug-CGI.pm [...] rt.cpan.org
From: Yanick Champoux <yanick [...] babyl.dyndns.org>
Download (untitled) / with headers
text/plain 563b
On May 6, 2010 04:10:45 am you wrote: Show quoted text
> No :) I think this is the CGI::Carp's bug, not in 'base'.
I didn't say it was a bug in base, I said it was probably caused by the meddling of 'die' on both side, and I was somewhat right. In both your examples, CGI::Carp::die is called without argument. The real die propagate the already-existing value of $@, if there is any. C::C::die wasn't doing the same thing. Tada. Mystery solved. :-) A patch to have C::C::die do the right thing is resting at http://github.com/yanick/CGI.pm/tree/rt-57224 Joy, `/anick
Subject: patch released for CGI.pm
Thanks for the bug report. A patch for it appeared in 3.51, if not sooner. Resolving. Mark


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.