Skip Menu |
 

This queue is for tickets about the Math-BigInt CPAN distribution.

Report information
The Basics
Id: 119805
Status: resolved
Priority: 0/
Queue: Math-BigInt

People
Owner: Nobody in particular
Requestors: stewart [...] linux.vnet.ibm.com
Cc:
AdminCc:

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

Attachments
0001-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch



X-TM-As-Gconf: 00
X-Ibm-Spammodules-Versions: BY=3.00006411; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000199; SDB=6.00805967; UDB=6.00392159; IPR=6.00583302; BA=6.00005042; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013886; XFM=3.00000011; UTC=2017-01-11 04:29:46
MIME-Version: 1.0
X-Spam-Status: No, score=-1.9 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9] autolearn=ham
X-Cpan.org: This message routed through the cpan.org mail forwarding service. Please use PAUSE pause.perl.org to configure your delivery settings.
X-Spam-Flag: NO
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1701110062
Message-ID: <87lguinrrg.fsf [...] linux.vnet.ibm.com>
content-type: text/plain; charset="utf-8"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -1.9
X-Content-Scanned: Fidelis XPS MAILER
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id C89C124041C for <cpan-bug+Math-BigInt [...] hipster.bestpractical.com>; Wed, 11 Jan 2017 03:31:14 -0500 (EST)
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 THh5BxhQYAjG for <cpan-bug+Math-BigInt [...] hipster.bestpractical.com>; Wed, 11 Jan 2017 03:31:13 -0500 (EST)
Received: from xx1.develooper.com (xx1.develooper.com [207.171.7.115]) by hipster.bestpractical.com (Postfix) with ESMTPS id 5CF1D2403ED for <bug-Math-BigInt [...] rt.cpan.org>; Wed, 11 Jan 2017 03:31:13 -0500 (EST)
Received: from localhost (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with ESMTP id 55BF767239 for <bug-Math-BigInt [...] rt.cpan.org>; Wed, 11 Jan 2017 00:31:12 -0800 (PST)
Received: from xx1.develooper.com (xx1.develooper.com [127.0.0.1]) by localhost (Postfix) with SMTP id D3F646723B for <bug-Math-BigInt [...] rt.cpan.org>; Wed, 11 Jan 2017 00:31:08 -0800 (PST)
Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by xx1.develooper.com (Postfix) with ESMTPS id 6481E67239 for <bug-Math-BigInt [...] rt.cpan.org>; Wed, 11 Jan 2017 00:31:04 -0800 (PST)
Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id v0B4Sdas093306 for <bug-Math-BigInt [...] rt.cpan.org>; Tue, 10 Jan 2017 23:29:47 -0500
Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 27w9pkgu6d-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for <bug-Math-BigInt [...] rt.cpan.org>; Tue, 10 Jan 2017 23:29:47 -0500
Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for <bug-Math-BigInt [...] rt.cpan.org> from <stewart [...] linux.vnet.ibm.com>; Tue, 10 Jan 2017 23:29:46 -0500
Received: from d01dlp03.pok.ibm.com (9.56.250.168) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 10 Jan 2017 23:29:44 -0500
Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id F0A8CC9003E for <bug-Math-BigInt [...] rt.cpan.org>; Tue, 10 Jan 2017 23:29:26 -0500 (EST)
Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v0B4Tiqu17564066 for <bug-Math-BigInt [...] rt.cpan.org>; Wed, 11 Jan 2017 04:29:44 GMT
Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1D64DAC03A for <bug-Math-BigInt [...] rt.cpan.org>; Tue, 10 Jan 2017 23:29:44 -0500 (EST)
Received: from birb.localdomain (unknown [9.185.16.79]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 98171AC041 for <bug-Math-BigInt [...] rt.cpan.org>; Tue, 10 Jan 2017 23:29:43 -0500 (EST)
Received: by birb.localdomain (Postfix, from userid 1000) id 81DCD229DB2F; Wed, 11 Jan 2017 15:29:39 +1100 (AEDT)
Delivered-To: cpan-bug+Math-BigInt [...] hipster.bestpractical.com
Subject: Regression in ignoring trailing whitespace: Math::BigInt->new('0x10\n\t\t')
User-Agent: Notmuch/0.21+24~gbceb651 (http://notmuchmail.org) Emacs/25.1.1 (x86_64-redhat-linux-gnu)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-11_02:,, signatures=0
X-Ibm-Av-Detection: SAVI=unused REMOTE=unused XFE=unused
Return-Path: <stewart [...] linux.vnet.ibm.com>
X-RT-Mail-Extension: math-bigint
X-Original-To: cpan-bug+Math-BigInt [...] hipster.bestpractical.com
X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1100_1199 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_CTA_URI_FOUND 0, NO_URI_FOUND 0, NO_URI_HTTPS 0, PHISH_TRUSTED_RDNS 0, SPF_NONE 0, __CT 0, __CT_TEXT_PLAIN 0, __FRAUD_MONEY_CURRENCY 0, __FRAUD_MONEY_CURRENCY_DOLLAR 0, __FUR_RDNS_CITIGROUP 0, __HAS_FROM 0, __HAS_MSGID 0, __MIME_TEXT_ONLY 0, __MIME_TEXT_P 0, __MIME_TEXT_P1 0, __MIME_VERSION 0, __NO_HTML_TAG_RAW 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __USER_AGENT 0, __blackholes.mail-abuse.org_TIMEOUT , __zen.spamhaus.org_ERROR '
Date: Wed, 11 Jan 2017 15:29:39 +1100
X-Spam-Level:
X-Greylist: delayed 14470 seconds by postgrey-1.34 at xx1.develooper.com; Wed, 11 Jan 2017 00:31:04 PST
X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2017.1.11.82417
X-Cbid: 17011104-0040-0000-0000-00000253EA5A
X-Ibm-Spammodules-Scores:
X-Cbparentid: 17011104-0041-0000-0000-00000646F553
To: bug-Math-BigInt [...] rt.cpan.org
From: Stewart Smith <stewart [...] linux.vnet.ibm.com>
X-RT-Original-Encoding: ascii
X-RT-Interface: Email
Content-Length: 1089
The Math::BigInt manual states that leading and trailing whitespace is ignored, and in fact this has been the behaviour for many years. However, in recent Math::BigInt (that has shipped in Linux distributions... e.g. Fedora 25), this behaviour is broken, which breaks our tools that rely on this. With Math::BigInt 1.999727: 'use Math::BigInt; print Dumper(Math::BigInt->new("0x10\n\t\t\t"));'; $VAR1 = bless( { 'sign' => 'NaN', 'value' => [ 0 ] }, 'Math::BigInt' ); With Math::BigInt 1.9993: 'use Math::BigInt; print Dumper(Math::BigInt->new("0x10\n\t\t\t"));'; $VAR1 = bless( { 'sign' => '+', 'value' => [ 16 ] }, 'Math::BigInt' ); The first version to exhibit this buggy behaviour was 1.999712, with 1.999710 and 1.9997_11 both not having the bug. All versions after 1.999712, including the latest, 1.999807 exhibit the bug. -- Stewart Smith OPAL Architect, IBM.
MIME-Version: 1.0
In-Reply-To: <87lguinrrg.fsf [...] linux.vnet.ibm.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: API
References: <87lguinrrg.fsf [...] linux.vnet.ibm.com>
Content-Type: multipart/mixed; boundary="----------=_1484123678-5964-2"
Message-ID: <rt-4.0.18-5964-1484123678-259.0-0-0 [...] rt.cpan.org>
Message-ID: <rt-4.0.18-5964-1484123678-757.119805-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
From: ppisar [...] redhat.com
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: 472
Download (untitled) / with headers
text/plain 472b
Dne St 11.led.2017 03:31:15, stewart@linux.vnet.ibm.com napsal(a): Show quoted text
> The Math::BigInt manual states that leading and trailing whitespace is > ignored, and in fact this has been the behaviour for many years. > > However, in recent Math::BigInt (that has shipped in Linux > distributions... e.g. Fedora 25), this behaviour is broken,
Attached patch fixes is by accepting leading and trailing space by from_hex(), from_bin(), and from_oct() in Math::BigInt and Math::Float.
MIME-Version: 1.0
Subject: 0001-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Type: application/octet-stream; name="0001-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch"
Content-Disposition: inline; filename="0001-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch"
Content-Transfer-Encoding: base64
Content-Length: 5268
From bf86903d387f0b7668483583d1b1b9883559e8d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> Date: Wed, 11 Jan 2017 09:24:21 +0100 Subject: [PATCH] Ignore leading and trailing white spaces for non-decimal input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Documentation reads that surrounding white space is ignored. But this does not work for non-decimal numbers since Math-BigInt-1.999712: $ perl -MMath::BigInt -e 'print Math::BigInt->new(" 0x1 "), qq{\n}' NaN This patch fixes it. <https://bugzilla.redhat.com/show_bug.cgi?id=1412052> Signed-off-by: Petr Písař <ppisar@redhat.com> --- lib/Math/BigFloat.pm | 6 ++++++ lib/Math/BigInt.pm | 6 ++++++ t/from_bin-mbf.t | 4 +++- t/from_bin-mbi.t | 4 +++- t/from_hex-mbf.t | 4 +++- t/from_hex-mbi.t | 4 +++- t/from_oct-mbf.t | 4 +++- t/from_oct-mbi.t | 4 +++- 8 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm index 18780b4..98f19d8 100644 --- a/lib/Math/BigFloat.pm +++ b/lib/Math/BigFloat.pm @@ -529,6 +529,7 @@ sub from_hex { if ($str =~ s/ ^ + \s* # sign ( [+-]? ) @@ -555,6 +556,7 @@ sub from_hex { ( \d+ (?: _ \d+ )* ) )? + \s* $ //x) { @@ -618,6 +620,7 @@ sub from_oct { if ($str =~ s/ ^ + \s* # sign ( [+-]? ) @@ -641,6 +644,7 @@ sub from_oct { ( \d+ (?: _ \d+ )* ) )? + \s* $ //x) { @@ -704,6 +708,7 @@ sub from_bin { if ($str =~ s/ ^ + \s* # sign ( [+-]? ) @@ -730,6 +735,7 @@ sub from_bin { ( \d+ (?: _ \d+ )* ) )? + \s* $ //x) { diff --git a/lib/Math/BigInt.pm b/lib/Math/BigInt.pm index da9075d..a6508ea 100644 --- a/lib/Math/BigInt.pm +++ b/lib/Math/BigInt.pm @@ -731,12 +731,14 @@ sub from_hex { if ($str =~ s/ ^ + \s* ( [+-]? ) (0?x)? ( [0-9a-fA-F]* ( _ [0-9a-fA-F]+ )* ) + \s* $ //x) { @@ -785,11 +787,13 @@ sub from_oct { if ($str =~ s/ ^ + \s* ( [+-]? ) ( [0-7]* ( _ [0-7]+ )* ) + \s* $ //x) { @@ -838,12 +842,14 @@ sub from_bin { if ($str =~ s/ ^ + \s* ( [+-]? ) (0?b)? ( [01]* ( _ [01]+ )* ) + \s* $ //x) { diff --git a/t/from_bin-mbf.t b/t/from_bin-mbf.t index e24cd3b..893662d 100644 --- a/t/from_bin-mbf.t +++ b/t/from_bin-mbf.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 183; +use Test::More tests => 190; my $class; @@ -88,3 +88,5 @@ NaN:NaN +inf:NaN -inf:NaN 0b.p+0:NaN + + 0b1 :1 diff --git a/t/from_bin-mbi.t b/t/from_bin-mbi.t index b33eb67..b83d87d 100644 --- a/t/from_bin-mbi.t +++ b/t/from_bin-mbi.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 344; +use Test::More tests => 351; my $class; @@ -114,3 +114,5 @@ __END__ NaN:NaN +inf:NaN -inf:NaN + + 0b1 :1 diff --git a/t/from_hex-mbf.t b/t/from_hex-mbf.t index 1a39949..000b2ab 100644 --- a/t/from_hex-mbf.t +++ b/t/from_hex-mbf.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 183; +use Test::More tests => 190; my $class; @@ -88,3 +88,5 @@ NaN:NaN +inf:NaN -inf:NaN 0x.p+0:NaN + + 0x1 :1 diff --git a/t/from_hex-mbi.t b/t/from_hex-mbi.t index 2bb1301..a4c6227 100644 --- a/t/from_hex-mbi.t +++ b/t/from_hex-mbi.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 344; +use Test::More tests => 351; my $class; @@ -114,3 +114,5 @@ __END__ NaN:NaN +inf:NaN -inf:NaN + + 0x1 :1 diff --git a/t/from_oct-mbf.t b/t/from_oct-mbf.t index b735bd5..d59c33c 100644 --- a/t/from_oct-mbf.t +++ b/t/from_oct-mbf.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 183; +use Test::More tests => 190; my $class; @@ -88,3 +88,5 @@ NaN:NaN +inf:NaN -inf:NaN .p+0:NaN + + 1 :1 diff --git a/t/from_oct-mbi.t b/t/from_oct-mbi.t index 3a7833d..9e40cb5 100644 --- a/t/from_oct-mbi.t +++ b/t/from_oct-mbi.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 344; +use Test::More tests => 351; my $class; @@ -114,3 +114,5 @@ __END__ NaN:NaN +inf:NaN -inf:NaN + + 1 :1 -- 2.7.4


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.