[perl-Encode/f20] Stringify all decode_utf8() arguments

Petr Pisar ppisar at fedoraproject.org
Fri Jan 3 09:42:26 UTC 2014


commit b913bedacd9ab81cded5fc1f4b9f3c32582e9c54
Author: Petr Písař <ppisar at redhat.com>
Date:   Fri Jan 3 10:38:39 2014 +0100

    Stringify all decode_utf8() arguments

 ...-2.54-Stringify-all-decode_utf8-arguments.patch |   64 ++++++++++++++++++++
 perl-Encode.spec                                   |    8 ++-
 2 files changed, 71 insertions(+), 1 deletions(-)
---
diff --git a/Encode-2.54-Stringify-all-decode_utf8-arguments.patch b/Encode-2.54-Stringify-all-decode_utf8-arguments.patch
new file mode 100644
index 0000000..934e361
--- /dev/null
+++ b/Encode-2.54-Stringify-all-decode_utf8-arguments.patch
@@ -0,0 +1,64 @@
+From 99e546cd7b6ca70b5c1e9f9a05f37fba802b59a8 Mon Sep 17 00:00:00 2001
+From: Dan Kogai <dankogai+github at gmail.com>
+Date: Sun, 22 Dec 2013 13:07:05 +0900
+Subject: [PATCH] Stringify all decode_utf8() arguments
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Upstream commit:
+
+commit 14307cf7e433056128727f5d738ee317ef05b016
+Author: Dan Kogai <dankogai+github at gmail.com>
+Date:   Sun Dec 22 13:07:05 2013 +0900
+
+    VERSION 2.56
+
+ported to 3.54.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ Encode.pm  | 2 +-
+ t/Encode.t | 6 +++++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/Encode.pm b/Encode.pm
+index 4285871..1dc2947 100644
+--- a/Encode.pm
++++ b/Encode.pm
+@@ -210,7 +210,7 @@ my $utf8enc;
+ sub decode_utf8($;$) {
+     my ( $octets, $check ) = @_;
+     return undef unless defined $octets;
+-    $octets .= '' if ref $octets;
++    $octets .= '';
+     $check   ||= 0;
+     $utf8enc ||= find_encoding('utf8');
+     my $string = $utf8enc->decode( $octets, $check );
+diff --git a/t/Encode.t b/t/Encode.t
+index 918975e..d490255 100644
+--- a/t/Encode.t
++++ b/t/Encode.t
+@@ -25,7 +25,7 @@ my @character_set = ('0'..'9', 'A'..'Z', 'a'..'z');
+ my @source = qw(ascii iso8859-1 cp1250);
+ my @destiny = qw(cp1047 cp37 posix-bc);
+ my @ebcdic_sets = qw(cp1047 cp37 posix-bc);
+-plan test => 38+$n*@encodings + 2*@source*@destiny*@character_set + 2*@ebcdic_sets*256 + 6 + 4;
++plan test => 38+$n*@encodings + 2*@source*@destiny*@character_set + 2*@ebcdic_sets*256 + 6 + 5;
+ my $str = join('',map(chr($_),0x20..0x7E));
+ my $cpy = $str;
+ ok(length($str),from_to($cpy,'iso8859-1','Unicode'),"Length Wrong");
+@@ -150,6 +150,10 @@ package main;
+ ok(decode(latin1 => Encode::Dummy->new("foobar")), "foobar");
+ ok(encode(utf8   => Encode::Dummy->new("foobar")), "foobar");
+ 
++# RT#91569
++# decode_utf8 with non-string arguments
++ok(decode_utf8(*1), "*main::1");
++
+ # hash keys
+ my $key = (keys %{{ "whatever\x{100}" => '' }})[0];
+ my $kopy = $key;
+-- 
+1.8.3.1
+
diff --git a/perl-Encode.spec b/perl-Encode.spec
index 68f797d..8e38281 100644
--- a/perl-Encode.spec
+++ b/perl-Encode.spec
@@ -1,12 +1,14 @@
 Name:           perl-Encode
 Epoch:          1
 Version:        2.54
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Character encodings in Perl
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Encode/
 Source0:        http://www.cpan.org/authors/id/D/DA/DANKOGAI/Encode-%{version}.tar.gz
+# Stringify all decode_utf8() arguments, bug #1048134, CPAN RT#91569, in 2.56
+Patch0:         Encode-2.54-Stringify-all-decode_utf8-arguments.patch
 BuildRequires:  perl
 BuildRequires:  perl(ExtUtils::MakeMaker)
 BuildRequires:  perl(File::Spec)
@@ -75,6 +77,7 @@ your own encoding to perl. No knowledge of XS is necessary.
 
 %prep
 %setup -q -n Encode-%{version}
+%patch0 -p1
 
 %build
 # Additional scripts can be installed by appending MORE_SCRIPTS, UCM files by
@@ -109,6 +112,9 @@ make test
 %{perl_vendorarch}/Encode/encode.h
 
 %changelog
+* Fri Jan 03 2014 Petr Pisar <ppisar at redhat.com> - 1:2.54-2
+- Stringify all decode_utf8() arguments (bug #1048134)
+
 * Mon Sep 02 2013 Petr Pisar <ppisar at redhat.com> - 1:2.54-1
 - 2.54 bump
 


More information about the scm-commits mailing list