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
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1273062260-6784-103"
Content-Length: 0
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 1054
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
MIME-Version: 1.0
Content-Type: application/x-gzip; name="eval.tgz"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline; filename="eval.tgz"
Content-Transfer-Encoding: base64
Content-Length: 417
Download eval.tgz
application/x-gzip 417b

Message body not shown because it is not plain text.

MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-6776-1273070144-890.57224-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 366
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.
MIME-Version: 1.0
In-Reply-To: <rt-3.8.HEAD-6776-1273070144-890.57224-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
References: <rt-3.8.HEAD-6776-1273070144-890.57224-0-0 [...] rt.cpan.org>
Content-Type: multipart/mixed; boundary="----------=_1273133442-6780-108"
Message-ID: <rt-3.8.HEAD-6780-1273133442-1061.57224-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 839
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.
MIME-Version: 1.0
Subject: test.pl
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Type: text/x-perl; name="test.pl"
Content-Disposition: inline; filename="test.pl"
Content-Transfer-Encoding: binary
Content-Length: 174
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 $@;
From yanick [...] babyl.dyndns.org Thu May 6 19: 50:37 2010
MIME-Version: 1.0
X-Spam-Status: No, score=-10.599 tagged_above=-99.9 required=10 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_HI=-8] autolearn=ham
In-Reply-To: <rt-3.8.HEAD-6780-1273133444-910.57224-15-0 [...] rt.cpan.org>
X-Ironport-Anti-Spam-Result: AnkFABry4kvO+Ir8/2dsb2JhbACRWIwxcr0NhRMEjDA
X-Spam-Flag: NO
References: <RT-Ticket-57224 [...] rt.cpan.org> <rt-3.8.HEAD-6776-1273070144-890.57224-15-0 [...] rt.cpan.org> <rt-3.8.HEAD-6780-1273133444-910.57224-15-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Ironport-Anti-Spam-Filtered: true
Content-Type: Text/Plain; charset="utf-8"
Message-ID: <201005061950.42583.yanick [...] babyl.dyndns.org>
X-RT-Original-Encoding: utf-8
X-Spam-Score: -10.599
X-Ironport-Av: E=Sophos;i="4.52,344,1270440000"; d="scan'208";a="63625758"
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 7F4B62406FE for <cpan-bug+CGI.pm [...] hipster.bestpractical.com>; Thu, 6 May 2010 19:50:37 -0400 (EDT)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VwGJpwPT6s4U for <cpan-bug+CGI.pm [...] hipster.bestpractical.com>; Thu, 6 May 2010 19:50:35 -0400 (EDT)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id C4EAA240629 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 6 May 2010 19:50:34 -0400 (EDT)
Received: (qmail 28100 invoked by uid 103); 6 May 2010 23:50:52 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 6 May 2010 23:50:52 -0000
Received: from ironport2-out.teksavvy.com (HELO ironport2-out.pppoe.ca) (206.248.154.183) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 06 May 2010 16:50:47 -0700
Received: from 206-248-138-252.dsl.teksavvy.com (HELO gilgamesh.babyl.dyndns.org) ([206.248.138.252]) by ironport2-out.pppoe.ca with ESMTP; 06 May 2010 19:50:43 -0400
Received: by gilgamesh.babyl.dyndns.org (Postfix, from userid 65534) id CD41C439E5; Thu, 6 May 2010 20:59:34 -0400 (EDT)
Received: from enkidu.localnet (enkidu [192.168.0.103]) by gilgamesh.babyl.dyndns.org (Postfix) with ESMTP id 01BD2439E5 for <bug-CGI.pm [...] rt.cpan.org>; Thu, 6 May 2010 20:59:33 -0400 (EDT)
Delivered-To: cpan-bug+CGI.pm [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #57224] CGI::Carp works incorrectly if we have an exception in a package of one of parents
User-Agent: KMail/1.13.2 (Linux/2.6.32-22-generic; KDE/4.4.2; i686; ; )
Return-Path: <yanick [...] babyl.dyndns.org>
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: cpan-bug+CGI.pm [...] hipster.bestpractical.com
X-RT-Mail-Extension: cgi.pm
X-Old-Spam-Status: No, score=-99.0 required=5.0 tests=ALL_TRUSTED, DNS_FROM_OPENWHOIS,USER_IN_WHITELIST autolearn=disabled version=3.2.4
Date: Thu, 6 May 2010 19:50:41 -0400
X-Old-Spam-Level:
X-Spam-Level:
To: bug-CGI.pm [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Yanick Champoux <yanick [...] babyl.dyndns.org>
RT-Message-ID: <rt-3.8.HEAD-6784-1273189857-1367.57224-0-0 [...] rt.cpan.org>
Content-Length: 563
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
MIME-Version: 1.0
Subject: patch released for CGI.pm
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-19313-1295833534-247.57224-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 98
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.