Skip Menu |
 

This queue is for tickets about the Scalar-List-Utils CPAN distribution.

Report information
The Basics
Id: 31054
Status: resolved
Priority: 0/
Queue: Scalar-List-Utils

People
Owner: Nobody in particular
Requestors: paul.bijnens [...] xplanation.com
Cc:
AdminCc:

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



MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00
content-type: text/plain; charset="utf-8"; format="flowed"
X-Xplanation-Mailscanner-From: paul.bijnens [...] xplanation.com
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id D10C74D82CB for <bug-scalar-list-utils [...] rt.cpan.org>; Thu, 29 Nov 2007 05:02:00 -0500 (EST)
Received: (qmail 32696 invoked by alias); 29 Nov 2007 09:35:18 -0000
Received: from ip242.xplanation.com (HELO ip244.xplanation.com) (194.78.91.242) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 29 Nov 2007 01:35:16 -0800
Received: from charmes.be.xplanation.com (charmes.be.xplanation.com [10.32.1.52]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ip244.xplanation.com (Postfix) with ESMTP id 5FA6820053 for <bug-Scalar-List-Utils [...] rt.cpan.org>; Thu, 29 Nov 2007 10:35:04 +0100 (CET)
Delivered-To: cpan-bug+scalar-list-utils [...] diesel.bestpractical.com
User-Agent: Thunderbird 2.0.0.9 (X11/20071031)
Subject: small bug in Scalar::Util
Return-Path: <paul.bijnens [...] xplanation.com>
X-Original-To: bug-scalar-list-utils [...] rt.cpan.org
X-Spam-Check-BY: la.mx.develooper.com
X-Old-Spam-Status: No
Date: Thu, 29 Nov 2007 10:35:03 +0100
X-Xplanation-Mailscanner: Found to be clean
Message-Id: <474E87C7.4060000 [...] xplanation.com>
To: bug-Scalar-List-Utils [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Paul Bijnens <Paul.Bijnens [...] xplanation.com>
X-RT-Original-Encoding: ISO-8859-1
Content-Length: 2049
I encountered this little bug after an upgrade of perl 5.8.8 that fixed the pcre vulnerability on CentOS 5, which suddenly failed to have the XS version of Scalar::Util (not sure why that happened). Just force an install of the Scalar::Util package fixed that problem, but while investigating what was wrong, I encountered another small bug. In Scalar::Util the function export_fail tests this (line 28-31): if (grep { /^(dualvar|set_prototype)$/ } @_ ) { require Carp; Carp::croak("$1 is only avaliable with the XS version"); } The bug is that the reg.exp. tries to set $1, but that var goes out of scope outside the block, resulting in an undefined variable in the croak string and no indication that it was actually dualvar or set_prototype that triggered the error. test: perl -le '@a=("A".."H"); if (grep { /^(C)$/ && print "in[$1]"} @a) { print "out[$1]" }' Easiest fix: if (grep { /^(?:dualar|setprototype)$/ @_ ) { require Carp; Carp::croak("dualvar and set_prototype only available with the XS version"); } And while we're at it, the previous tests in the same function could also replace the catching parentheses "(xx|yy)" with just grouping constructions (?:xx|yy) for a marginal speedup. -- Paul Bijnens, xplanation Technology Services Tel +32 16 397.511 Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM Fax +32 16 397.512 http://www.xplanation.com/ email: Paul.Bijnens@xplanation.com *********************************************************************** * I think I've got the hang of it now: exit, ^D, ^C, ^\, ^Z, ^Q, ^^, * * F6, quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, * * stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt, abort, hangup, * * PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e, kill -1 $$, shutdown, * * init 0, kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... * * ... "Are you sure?" ... YES ... Phew ... I'm out * ***********************************************************************
MIME-Version: 1.0
In-Reply-To: <474E87C7.4060000 [...] xplanation.com>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
References: <474E87C7.4060000 [...] xplanation.com>
Message-Id: <rt-3.6.HEAD-4630-1203268459-177.31054-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 1802
Download (untitled) / with headers
text/plain 1.7k
On Thu Nov 29 05:03:08 2007, paul.bijnens@xplanation.com wrote: Show quoted text
> > I encountered this little bug after an upgrade of perl 5.8.8 that > fixed the pcre vulnerability on CentOS 5, which suddenly failed to > have the XS version of Scalar::Util (not sure why that happened). > Just force an install of the Scalar::Util package fixed that problem, > but while investigating what was wrong, I encountered another small bug. > > > In Scalar::Util the function export_fail tests this (line 28-31): > > if (grep { /^(dualvar|set_prototype)$/ } @_ ) { > require Carp; > Carp::croak("$1 is only avaliable with the XS version"); > } > > The bug is that the reg.exp. tries to set $1, but that var goes > out of scope outside the block, resulting in an undefined variable > in the croak string and no indication that it was actually dualvar > or set_prototype that triggered the error. > > test: > perl -le '@a=("A".."H"); > if (grep { /^(C)$/ && print "in[$1]"} @a) { print "out[$1]" }' > > Easiest fix: > > if (grep { /^(?:dualar|setprototype)$/ @_ ) { > require Carp; > Carp::croak("dualvar and set_prototype only available with the XS > version"); > } > > And while we're at it, the previous tests in the same function could > also replace the catching parentheses "(xx|yy)" with just grouping > constructions (?:xx|yy) for a marginal speedup. >
Alternative fix: { my @vars; if (grep { /^(dualvar|set_prototype)$/ and push @vars, $1 and 1 } @_ ) { require Carp; Carp::croak("@vars is only avaliable with the XS version"); } } This would show an error message for only the variable which actually failed, although grammtically incorrect if both (dualvar and set_prototype) are specified in the import list. Regards, Slaven
MIME-Version: 1.0
In-Reply-To: <474E87C7.4060000 [...] xplanation.com>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <474E87C7.4060000 [...] xplanation.com>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-17572-1241489800-1694.31054-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 70
This bug appears to be resolved in the 'next' branch in git. -- rjbs


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.