From 4cbc3566f213bae19c460399d5d6207df4124ea8 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <[email protected]>
Date: Tue, 2 Jun 2015 15:04:21 +0200
Subject: Fixed issue which appeared for Perl 5.21.2 and higher


diff --git a/Exception-Base-0.25-Fix-redundant-argument-in-sprintf.patch 
b/Exception-Base-0.25-Fix-redundant-argument-in-sprintf.patch
new file mode 100644
index 0000000..8861cfb
--- /dev/null
+++ b/Exception-Base-0.25-Fix-redundant-argument-in-sprintf.patch
@@ -0,0 +1,49 @@
+From 1cb0ea6afd4bb76e5a1d759efe27ea0f18306a82 Mon Sep 17 00:00:00 2001
+From: Lee Johnson <[email protected]>
+Date: Thu, 1 Jan 2015 22:33:54 +0000
+Subject: [PATCH] resolve #1 - fix warnings new since perl 5.21.2
+
+Redundant argument in %s - this is because the various calls to the
+sprintf function offset the arrays by 1 (since the first element of
+the array is the sprintf string) but use @_ (the number of elements
+in the array) in the range: 1 .. @_
+
+since it's offset by 1 we are going beyond the end of the array and
+so sprintf consequently warns that we sent more arguments than it
+expected. fix this by using @_ -1 in the range (number of elements
+in the array minus 1)
+---
+ lib/Exception/Base.pm | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/lib/Exception/Base.pm b/lib/Exception/Base.pm
+index 8dce19f..096e2a5 100644
+--- a/lib/Exception/Base.pm
++++ b/lib/Exception/Base.pm
+@@ -1362,7 +1362,7 @@ sub matches {   ## no critic qw(ProhibitExcessComplexity)
+                     local $_ = ref $self->{$key} eq 'ARRAY'
+                                ? sprintf(
+                                      @{$self->{$key}}[0],
+-                                     @{$self->{$key}}[1..@{$self->{$key}}]
++                                     @{$self->{$key}}[1..@{$self->{$key}}-1]
+                                  )
+                                : $self->{$key};
+                     if (ref $arrval eq 'CODE') {
+@@ -1393,7 +1393,7 @@ sub matches {   ## no critic qw(ProhibitExcessComplexity)
+             local $_ = ref $self->{$key} eq 'ARRAY'
+                        ? sprintf(
+                              @{$self->{$key}}[0],
+-                             @{$self->{$key}}[1..@{$self->{$key}}]
++                             @{$self->{$key}}[1..@{$self->{$key}}-1]
+                          )
+                        : $self->{$key};
+ 
+@@ -1613,7 +1613,7 @@ sub _string_attributes {
+     my ($self) = @_;
+ 
+     return map { ref $_ eq 'ARRAY'
+-                 ? sprintf(@$_[0], @$_[1..@$_])
++                 ? sprintf(@$_[0], @$_[1..@$_-1])
+                  : $_ }
+            grep { defined $_ and (ref $_ or $_ ne '') }
+            map { $self->{$_} }
diff --git a/perl-Exception-Base.spec b/perl-Exception-Base.spec
index 4ec4b99..254772a 100644
--- a/perl-Exception-Base.spec
+++ b/perl-Exception-Base.spec
@@ -1,11 +1,14 @@
 Name:           perl-Exception-Base
 Version:        0.2500
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Lightweight exceptions
 License:        GPL+ or Artistic
 
 URL:            http://search.cpan.org/dist/Exception-Base/
 Source0:        
http://www.cpan.org/authors/id/D/DE/DEXTER/Exception-Base-0.25.tar.gz
+# Fixed redundant argument in %s - appeared with perl 5.21.2
+# https://github.com/dex4er/perl-Exception-Base/issues/1
+Patch0:         Exception-Base-0.25-Fix-redundant-argument-in-sprintf.patch
 
 BuildArch:      noarch
 BuildRequires:  perl(Module::Build)
@@ -23,6 +26,7 @@ default verbosity is uppered for debugging purposes.
 
 %prep
 %setup -q -n Exception-Base-0.25
+%patch0 -p1
 
 %build
 %{__perl} Build.PL installdirs=vendor
@@ -43,6 +47,9 @@ find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 
2>/dev/null \;
 %{_mandir}/man3/*
 
 %changelog
+* Tue Jun 02 2015 Jitka Plesnikova <[email protected]> - 0.2500-6
+- Fixed issue which appeared for Perl 5.21.2 and higher
+
 * Wed Aug 27 2014 Jitka Plesnikova <[email protected]> - 0.2500-5
 - Perl 5.20 rebuild
 
-- 
cgit v0.10.2


        
http://pkgs.fedoraproject.org/cgit/perl-Exception-Base.git/commit/?h=master&id=4cbc3566f213bae19c460399d5d6207df4124ea8
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/perl-devel

Reply via email to