From parv_fm@mailsent.net  Tue Dec 17 00:54:06 2002
Return-Path: <parv_fm@mailsent.net>
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 <parv_fm@emailgroups.net>
To: FreeBSD-gnats-submit@freebsd.org
Cc: tobez@FreeBSD.org
Subject: lang/perl5 - string '0' (zero) is not converted to number as range operand
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>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:    tobez
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 17 01:00:20 PST 2002
>Closed-Date:    Tue Feb 01 11:39:22 CET 2005
>Last-Modified:  Tue Feb 01 11:39:22 CET 2005
>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:
Responsible-Changed-From-To: freebsd-ports->tobez 
Responsible-Changed-By: tobez 
Responsible-Changed-When: Tue Dec 17 10:42:54 CET 2002 
Responsible-Changed-Why:  
My port. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46322 

From: parv <parv@pair.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: ports/46322: lang/perl5 - string '0' (zero) is not converted to number as range operand
Date: Tue, 9 Dec 2003 23:38:45 -0500

 I have lost interest in this port & PR; do as you wish.
 
 
   - Parv
 
 -- 
 
State-Changed-From-To: open->analyzed 
State-Changed-By: vs 
State-Changed-When: Wed Jul 21 08:52:39 GMT 2004 
State-Changed-Why:  
While this is still an issue with 5.6.1, it's fixed in 5.8.4. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46322 
State-Changed-From-To: analyzed->closed 
State-Changed-By: tobez 
State-Changed-When: Tue Feb 1 11:37:59 CET 2005 
State-Changed-Why:  
This is still an issue in 5.6.2.  However, we cannot be responsible for 
every perl bug out there, especially is it is fixed in later (5.8.X) 
versions. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=46322 
>Unformatted:
