Subject: ppisar pushed to perl-Math-BigInt (f25). "Fix
accepting numbers surrounded with a white
space"



From 050ee2e06041ea1a7f6cf0ee203f98790da6d393 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
Date: Thu, 12 Jan 2017 10:29:31 +0100
Subject: Fix accepting numbers surrounded with a white space

---
...ing-and-trailing-white-spaces-for-non-dec.patch | 245 +++++++++++++++++++++
perl-Math-BigInt.spec | 9 +-
2 files changed, 253 insertions(+), 1 deletion(-)
create mode 100644
Math-BigInt-1.999727-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch

diff --git
a/Math-BigInt-1.999727-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch

b/Math-BigInt-1.999727-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch
new file mode 100644
index 0000000..d7bebd0
--- /dev/null
+++
b/Math-BigInt-1.999727-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch
@@ -0,0 +1,245 @@
+From 5c03061a16ec9af06e3d76d3757f9d3044d58d8e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <[email protected]>
+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.
+
+CPAN RT#119805
+
+Signed-off-by: Petr Písař <[email protected]>
+---
+ lib/Math/BigFloat.pm | 6 ++++++
+ lib/Math/BigInt.pm | 6 ++++++
+ t/from_bin-mbf.t | 15 ++++++++++++++-
+ t/from_hex-mbf.t | 15 ++++++++++++++-
+ t/from_oct-mbf.t | 15 ++++++++++++++-
+ 5 files changed, 54 insertions(+), 3 deletions(-)
+
+diff --git a/lib/Math/BigFloat.pm b/lib/Math/BigFloat.pm
+index 190e2ee..1030c46 100644
+--- a/lib/Math/BigFloat.pm
++++ b/lib/Math/BigFloat.pm
+@@ -526,6 +526,7 @@ sub from_hex {
+
+ if ($str =~ s/
+ ^
++ \s*
+
+ # sign
+ ( [+-]? )
+@@ -552,6 +553,7 @@ sub from_hex {
+ ( \d+ (?: _ \d+ )* )
+ )?
+
++ \s*
+ $
+ //x)
+ {
+@@ -611,6 +613,7 @@ sub from_oct {
+
+ if ($str =~ s/
+ ^
++ \s*
+
+ # sign
+ ( [+-]? )
+@@ -634,6 +637,7 @@ sub from_oct {
+ ( \d+ (?: _ \d+ )* )
+ )?
+
++ \s*
+ $
+ //x)
+ {
+@@ -693,6 +697,7 @@ sub from_bin {
+
+ if ($str =~ s/
+ ^
++ \s*
+
+ # sign
+ ( [+-]? )
+@@ -719,6 +724,7 @@ sub from_bin {
+ ( \d+ (?: _ \d+ )* )
+ )?
+
++ \s*
+ $
+ //x)
+ {
+diff --git a/lib/Math/BigInt.pm b/lib/Math/BigInt.pm
+index 24b14c4..b0782ac 100644
+--- a/lib/Math/BigInt.pm
++++ b/lib/Math/BigInt.pm
+@@ -729,12 +729,14 @@ sub from_hex {
+
+ if ($str =~ s/
+ ^
++ \s*
+ ( [+-]? )
+ (0?x)?
+ (
+ [0-9a-fA-F]*
+ ( _ [0-9a-fA-F]+ )*
+ )
++ \s*
+ $
+ //x)
+ {
+@@ -780,11 +782,13 @@ sub from_oct {
+
+ if ($str =~ s/
+ ^
++ \s*
+ ( [+-]? )
+ (
+ [0-7]*
+ ( _ [0-7]+ )*
+ )
++ \s*
+ $
+ //x)
+ {
+@@ -830,12 +834,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 a8c7527..caaaa2f 100644
+--- a/t/from_bin-mbf.t
++++ b/t/from_bin-mbf.t
+@@ -3,19 +3,32 @@
+ use strict;
+ use warnings;
+
+-use Test::More tests => 27;
++use Test::More tests => 1 + 26 * 4;
+
+ my $class;
+
+ BEGIN { $class = 'Math::BigFloat'; }
+ BEGIN { use_ok($class, '1.999710'); }
+
++my @data;
++my $space = "\t\r\n ";
++
+ while (<DATA>) {
+ s/#.*$//; # remove comments
+ s/\s+$//; # remove trailing whitespace
+ next unless length; # skip empty lines
+
+ my ($in0, $out0) = split /:/;
++
++ push @data, [ $in0, $out0 ],
++ [ $in0 . $space, $out0 ],
++ [ $space . $in0, $out0 ],
++ [ $space . $in0 . $space, $out0 ];
++}
++
++for my $entry (@data) {
++ my ($in0, $out0) = @$entry;
++
+ my $x;
+
+ my $test = qq|\$x = $class -> from_bin("$in0");|;
+diff --git a/t/from_hex-mbf.t b/t/from_hex-mbf.t
+index b45917a..8fa8a0b 100644
+--- a/t/from_hex-mbf.t
++++ b/t/from_hex-mbf.t
+@@ -3,19 +3,32 @@
+ use strict;
+ use warnings;
+
+-use Test::More tests => 27;
++use Test::More tests => 1 + 26 * 4;
+
+ my $class;
+
+ BEGIN { $class = 'Math::BigFloat'; }
+ BEGIN { use_ok($class, '1.999710'); }
+
++my @data;
++my $space = "\t\r\n ";
++
+ while (<DATA>) {
+ s/#.*$//; # remove comments
+ s/\s+$//; # remove trailing whitespace
+ next unless length; # skip empty lines
+
+ my ($in0, $out0) = split /:/;
++
++ push @data, [ $in0, $out0 ],
++ [ $in0 . $space, $out0 ],
++ [ $space . $in0, $out0 ],
++ [ $space . $in0 . $space, $out0 ];
++}
++
++for my $entry (@data) {
++ my ($in0, $out0) = @$entry;
++
+ my $x;
+
+ my $test = qq|\$x = $class -> from_hex("$in0");|;
+diff --git a/t/from_oct-mbf.t b/t/from_oct-mbf.t
+index 7e58454..19392f2 100644
+--- a/t/from_oct-mbf.t
++++ b/t/from_oct-mbf.t
+@@ -3,19 +3,32 @@
+ use strict;
+ use warnings;
+
+-use Test::More tests => 27;
++use Test::More tests => 1 + 26 * 4;
+
+ my $class;
+
+ BEGIN { $class = 'Math::BigFloat'; }
+ BEGIN { use_ok($class, '1.999710'); }
+
++my @data;
++my $space = "\t\r\n ";
++
+ while (<DATA>) {
+ s/#.*$//; # remove comments
+ s/\s+$//; # remove trailing whitespace
+ next unless length; # skip empty lines
+
+ my ($in0, $out0) = split /:/;
++
++ push @data, [ $in0, $out0 ],
++ [ $in0 . $space, $out0 ],
++ [ $space . $in0, $out0 ],
++ [ $space . $in0 . $space, $out0 ];
++}
++
++for my $entry (@data) {
++ my ($in0, $out0) = @$entry;
++
+ my $x;
+
+ my $test = qq|\$x = $class -> from_oct("$in0");|;
+--
+2.7.4
+
diff --git a/perl-Math-BigInt.spec b/perl-Math-BigInt.spec
index c03fb17..d3a10ad 100644
--- a/perl-Math-BigInt.spec
+++ b/perl-Math-BigInt.spec
@@ -2,12 +2,15 @@ Name: perl-Math-BigInt
%global cpan_version 1.999727
# Keep 4-digit version to compete with perl.spec
Version: %(echo %{cpan_version} | sed 's/\(\.....\)/\1./')
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Arbitrary-size integer and float mathematics
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/Math-BigInt/
Source0:
http://www.cpan.org/authors/id/P/PJ/PJACKLAM/Math-BigInt-%{cpan_version}.tar.gz
+# Fix accepting numbers surrounded with a white space, bug #1412052,
+# CPAN RT#119805, fixed in 1.999808
+Patch0:
Math-BigInt-1.999727-Ignore-leading-and-trailing-white-spaces-for-non-dec.patch
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: findutils
@@ -81,6 +84,7 @@ This provides Perl modules for arbitrary-size integer and
float mathematics.

%prep
%setup -q -n Math-BigInt-%{cpan_version}
+%patch0 -p1
# This core module must be buildable without non-core modules at bootstrap.
%if !%{defined perl_bootstrap}
# Remove bundled modules
@@ -110,6 +114,9 @@ make test
%{_mandir}/man3/*

%changelog
+* Thu Jan 12 2017 Petr Pisar <[email protected]> - 1.9997.27-2
+- Fix accepting numbers surrounded with a white space (bug #1412052)
+
* Tue Nov 08 2016 Petr Pisar <[email protected]> - 1.9997.27-1
- 1.999727 bump

--
cgit v0.12



http://pkgs.fedoraproject.org/cgit/perl-Math-BigInt.git/commit/?h=f25&id=050ee2e06041ea1a7f6cf0ee203f98790da6d393
_______________________________________________
perl-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Programming list archiving by: Enterprise Git Hosting