From 765c6152c11906f4e11bcfc4276e996ac1df1157 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Thu, 28 Jul 2016 10:37:31 +0200
Subject: Fix handling \N{} in tr for characters in range 128--255

---
 ...CH-perl-128734-tr-N-.-failing-for-128-255.patch | 62 ++++++++++++++++++++++
 perl.spec                                          | 11 +++-
 2 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100644 
perl-5.24.0-PATCH-perl-128734-tr-N-.-failing-for-128-255.patch

diff --git a/perl-5.24.0-PATCH-perl-128734-tr-N-.-failing-for-128-255.patch 
b/perl-5.24.0-PATCH-perl-128734-tr-N-.-failing-for-128-255.patch
new file mode 100644
index 0000000..a3c6bb2
--- /dev/null
+++ b/perl-5.24.0-PATCH-perl-128734-tr-N-.-failing-for-128-255.patch
@@ -0,0 +1,62 @@
+From 9b3f53bd7af9574dcc38432cb191b90e9f957362 Mon Sep 17 00:00:00 2001
+From: Karl Williamson <k...@cpan.org>
+Date: Wed, 27 Jul 2016 12:44:42 -0600
+Subject: [PATCH] PATCH: [perl #128734] tr/\N{...}/ failing for 128-255
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The upper latin1 characters when expressed as \N{U+...} were failing.
+This was due to trying to convert them to UTF-8 when the result isn't
+UTF-8.  I added a test for \N{name} as well, though these were not
+affected by this regression.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ t/op/tr.t | 11 ++++++++++-
+ toke.c    |  2 +-
+ 2 files changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/t/op/tr.t b/t/op/tr.t
+index 6783dad..d40187f 100644
+--- a/t/op/tr.t
++++ b/t/op/tr.t
+@@ -9,7 +9,7 @@ BEGIN {
+     set_up_inc('../lib');
+ }
+ 
+-plan tests => 164;
++plan tests => 166;
+ 
+ # Test this first before we extend the stack with other operations.
+ # This caused an asan failure due to a bad write past the end of the stack.
+@@ -643,4 +643,13 @@ for ("", nullrocow) {
+       ok(1, "tr///d on glob does not assert");
+ }
+ 
++{ # [perl #128734
++    my $string = "\x{00e0}";
++    $string =~ tr/\N{U+00e0}/A/;
++    is($string, "A", 'tr// of \N{U+...} works for upper-Latin1');
++    $string = "\x{00e1}";
++    $string =~ tr/\N{LATIN SMALL LETTER A WITH ACUTE}/A/;
++    is($string, "A", 'tr// of \N{name} works for upper-Latin1');
++}
++
+ 1;
+diff --git a/toke.c b/toke.c
+index 59a0749..52e658f 100644
+--- a/toke.c
++++ b/toke.c
+@@ -3540,7 +3540,7 @@ S_scan_const(pTHX_ char *start)
+                       }
+ 
+                         /* Add the (Unicode) code point to the output. */
+-                      if (OFFUNI_IS_INVARIANT(uv)) {
++                      if (! has_utf8 || OFFUNI_IS_INVARIANT(uv)) {
+                           *d++ = (char) LATIN1_TO_NATIVE(uv);
+                       }
+                       else {
+-- 
+2.5.5
+
diff --git a/perl.spec b/perl.spec
index a75ecb9..c4986cc 100644
--- a/perl.spec
+++ b/perl.spec
@@ -28,7 +28,7 @@
 Name:           perl
 Version:        %{perl_version}
 # release number must be even higher, because dual-lived modules will be 
broken otherwise
-Release:        375%{?dist}
+Release:        376%{?dist}
 Epoch:          %{perl_epoch}
 Summary:        Practical Extraction and Report Language
 Group:          Development/Languages
@@ -157,6 +157,10 @@ Patch41:        
perl-5.25.2-SEGV-in-Subroutine-redefined-warning.patch
 # Fix a crash in lexical scope warnings, RT#128597, in upstream after 5.25.2
 Patch42:        perl-5.25.2-perl-128597-Crash-from-gp_free-ckWARN_d.patch
 
+# Fix handling \N{} in tr for characters in range 128--255, RT#128734,
+# in upstream after 5.25.3
+Patch43:        perl-5.24.0-PATCH-perl-128734-tr-N-.-failing-for-128-255.patch
+
 # Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
 Patch200:       
perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
 
@@ -2819,6 +2823,7 @@ Perl extension for Version Objects
 %patch40 -p1
 %patch41 -p1
 %patch42 -p1
+%patch43 -p1
 %patch200 -p1
 %patch201 -p1
 
@@ -2852,6 +2857,7 @@ perl -x patchlevel.h \
     'Fedora Patch40: Fix a crash when vivifying a stub in a deleted package 
(RT#128532)' \
     'Fedora Patch41: Fix a crash in "Subroutine redefined" warning 
(RT#128257)' \
     'Fedora Patch42: Fix a crash in lexical scope warnings (RT#128597)' \
+    'Fedora Patch43: Fix handling \N{} in tr for characters in range 128--255 
(RT#128734)' \
     'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on 
Linux' \
     'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
     %{nil}
@@ -5130,6 +5136,9 @@ popd
 
 # Old changelog entries are preserved in CVS.
 %changelog
+* Thu Jul 28 2016 Petr Pisar <ppi...@redhat.com> - 4:5.24.0-376
+- Fix handling \N{} in tr for characters in range 128--255 (RT#128734)
+
 * Tue Jul 26 2016 Petr Pisar <ppi...@redhat.com> - 4:5.24.0-375
 - Fix building without perl in the build root
 - Own systemtap directories by perl-devel
-- 
cgit v0.12


        
http://pkgs.fedoraproject.org/cgit/perl.git/commit/?h=master&id=765c6152c11906f4e11bcfc4276e996ac1df1157
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/perl-devel@lists.fedoraproject.org

Reply via email to