From owner-freebsd-ports Tue Dec 17 1: 0:24 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BB90637B401 for ; Tue, 17 Dec 2002 01:00:21 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id BAC0943ED1 for ; Tue, 17 Dec 2002 01:00:20 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBH90Kx3067480 for ; Tue, 17 Dec 2002 01:00:20 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBH90KEH067479; Tue, 17 Dec 2002 01:00:20 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1541837B401; Tue, 17 Dec 2002 00:54:06 -0800 (PST) Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id E5DD343EC5; Tue, 17 Dec 2002 00:53:57 -0800 (PST) (envelope-from parv_fm@mailsent.net) Received: from sdn-ap-018dcwashp0238.dialsprint.net ([63.188.176.238] helo=moo.holy.cow) by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 18ODU4-0007aJ-00; Tue, 17 Dec 2002 00:53:49 -0800 Received: by moo.holy.cow (Postfix, from userid 1001) id 0E1E1B930; Tue, 17 Dec 2002 03:56:39 -0500 (EST) Message-Id: <20021217085639.0E1E1B930@moo.holy.cow> Date: Tue, 17 Dec 2002 03:56:39 -0500 (EST) From: parv To: FreeBSD-gnats-submit@FreeBSD.org Cc: tobez@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: ports/46322: lang/perl5 - string '0' (zero) is not converted to number as range operand Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >Number: 46322 >Category: ports >Synopsis: lang/perl5 - string '0' (zero) is not converted to number as range operand >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Dec 17 01:00:20 PST 2002 >Closed-Date: >Last-Modified: >Originator: parv >Release: FreeBSD 4.7-RELEASE-p2 i386 >Organization: bitter almonds >Environment: System: FreeBSD moo.holy.cow 4.7-RELEASE-p2 perl 5.6.1 compiled on oct 29 2002 >Description: following code should print a list of numbers from -2 to 0 but doesn't... perl -e 'print "$_ " for "-2" .. "0"' see also... http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-10/msg01179.html http://groups.google.com/groups?th=5ca62e9cb8bd3366 >How-To-Repeat: install perl 5.6.1, run above code. >Fix: lifted from... http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-10/msg01179.html ...following patch is claimed to fix the problem... ==== //depot/perl/pp_ctl.c#325 (text) ==== Index: perl/pp_ctl.c --- perl/pp_ctl.c#324~18048~ Tue Oct 22 22:34:26 2002 +++ perl/pp_ctl.c Thu Oct 31 01:17:12 2002 @@ -943,10 +943,15 @@ if (SvGMAGICAL(right)) mg_get(right); + /* This code tries to decide if "$left .. $right" should use the + magical string increment, or if the range is numeric (we make + an exception for .."0" [#18165]). AMS 20021031. */ + if (SvNIOKp(left) || !SvPOKp(left) || SvNIOKp(right) || !SvPOKp(right) || (looks_like_number(left) && *SvPVX(left) != '0' && - looks_like_number(right) && *SvPVX(right) != '0')) + looks_like_number(right) && (*SvPVX(right) != '0' || + SvCUR(right) == 1))) { if (SvNV(left) < IV_MIN || SvNV(right) > IV_MAX) DIE(aTHX_ "Range iterator outside integer range"); ==== //depot/perl/t/op/range.t#9 (xtext) ==== Index: perl/t/op/range.t --- perl/t/op/range.t#8~4730~ Wed Dec 29 01:25:56 1999 +++ perl/t/op/range.t Thu Oct 31 01:17:12 2002 @@ -1,6 +1,6 @@ #!./perl -print "1..15\n"; +print "1..16\n"; print join(':',1..5) eq '1:2:3:4:5' ? "ok 1\n" : "not ok 1\n"; @@ -73,3 +73,7 @@ print "not "; } print "ok 15\n"; + +# [#18165] Should allow "-4".."0", broken by #4730. (AMS 20021031) +print "not " unless 5 == (() = "-4".."0"); +print "ok 16\n"; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message