From c297bdefcd7ea2cb480fcbcf09069feba5181c56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Fri, 16 Jun 2017 14:54:28 +0200
Subject: Fix UTF-8 flag on a glob reassignment

---
 ...-clear-the-UTF8-flag-on-a-glob-if-it-isn-.patch | 72 ++++++++++++++++++++++
 perl.spec                                          |  7 +++
 2 files changed, 79 insertions(+)
 create mode 100644 
perl-5.24.1-perl-131263-clear-the-UTF8-flag-on-a-glob-if-it-isn-.patch

diff --git 
a/perl-5.24.1-perl-131263-clear-the-UTF8-flag-on-a-glob-if-it-isn-.patch 
b/perl-5.24.1-perl-131263-clear-the-UTF8-flag-on-a-glob-if-it-isn-.patch
new file mode 100644
index 0000000..9610bc0
--- /dev/null
+++ b/perl-5.24.1-perl-131263-clear-the-UTF8-flag-on-a-glob-if-it-isn-.patch
@@ -0,0 +1,72 @@
+From 064604f904546ae4ddada5a2aa30256faccee39c Mon Sep 17 00:00:00 2001
+From: Tony Cook <t...@develop-help.com>
+Date: Wed, 7 Jun 2017 15:00:26 +1000
+Subject: [PATCH] clear the UTF8 flag on a glob if it isn't UTF8
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Ported to 5.24.1:
+
+commit 1097da16b21fe0a2257dba9937e55c0cca18f7e1
+Author: Tony Cook <t...@develop-help.com>
+Date:   Wed Jun 7 15:00:26 2017 +1000
+
+    [perl #131263] clear the UTF8 flag on a glob if it isn't UTF8
+
+    Previously sv_2pv_flags() would set the UTF8 flag on a glob if it
+    had a UTF8 name, but wouldn't clear tha flag if it didn't.
+
+    This meant a name change, eg. if assigned another glob, from a UTF8
+    name to a non-UTF8 name would leave the flag set.
+
+Signed-off-by: Petr Písař <ppi...@redhat.com>
+---
+ sv.c      |  2 ++
+ t/op/gv.t | 10 +++++++++-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/sv.c b/sv.c
+index 12cbb5f..05584a2 100644
+--- a/sv.c
++++ b/sv.c
+@@ -3162,6 +3162,8 @@ Perl_sv_2pv_flags(pTHX_ SV *const sv, STRLEN *const lp, 
const I32 flags)
+       assert(SvPOK(buffer));
+       if (SvUTF8(buffer))
+           SvUTF8_on(sv);
++        else
++            SvUTF8_off(sv);
+       if (lp)
+           *lp = SvCUR(buffer);
+       return SvPVX(buffer);
+diff --git a/t/op/gv.t b/t/op/gv.t
+index cdaaef5..ea79e51 100644
+--- a/t/op/gv.t
++++ b/t/op/gv.t
+@@ -12,7 +12,7 @@ BEGIN {
+ 
+ use warnings;
+ 
+-plan(tests => 277 );
++plan(tests => 279 );
+ 
+ # type coercion on assignment
+ $foo = 'foo';
+@@ -1173,6 +1173,14 @@ SKIP: {
+ # [perl #131085] This used to crash; no ok() necessary.
+ $::{"A131085"} = sub {}; \&{"A131085"};
+ 
++{
++    # [perl #131263]
++    *sym = "\N{U+0080}";
++    ok(*sym eq "*main::\N{U+0080}", "utf8 flag properly set");
++    *sym = "\xC3\x80";
++    ok(*sym eq "*main::\xC3\x80", "utf8 flag properly cleared");
++}
++
+ 
+ __END__
+ Perl
+-- 
+2.9.4
+
diff --git a/perl.spec b/perl.spec
index 36ea51a..a01b07c 100644
--- a/perl.spec
+++ b/perl.spec
@@ -359,6 +359,10 @@ Patch99:        
perl-5.27.0-Fix-131190-UTF8-code-improperly-casting-negative-int
 Patch100:       
perl-5.27.0-perl-131221-improve-duplication-of-via-handles.patch
 Patch101:       
perl-5.27.0-perl-131221-sv_dup-sv_dup_inc-are-only-available-und.patch
 
+# Fix glob UTF-8 flag on a glob reassignment, RT#131263,
+# in upstream after 5.27.0
+Patch102:       
perl-5.24.1-perl-131263-clear-the-UTF8-flag-on-a-glob-if-it-isn-.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
 
@@ -3098,6 +3102,7 @@ popd
 %patch99 -p1
 %patch100 -p1
 %patch101 -p1
+%patch102 -p1
 %patch200 -p1
 %patch201 -p1
 
@@ -3179,6 +3184,7 @@ perl -x patchlevel.h \
     'Fedora Patch98: Fix a crash when calling a subroutine from a stash 
(RT#131085)' \
     'Fedora Patch99: Fix an improper cast of a negative integer to an unsigned 
8-bit type (RT#131190)' \
     'Fedora Patch100: Fix cloning :via handles on thread creation (RT#131221)' 
\
+    'Fedora Patch102: Fix glob UTF-8 flag on a glob reassignment (RT#131263)' \
     '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}
@@ -5475,6 +5481,7 @@ popd
 - Fix a crash when calling a subroutine from a stash (RT#131085)
 - Fix an improper cast of a negative integer to an unsigned 8-bit type 
(RT#131190)
 - Fix cloning :via handles on thread creation (RT#131221)
+- Fix glob UTF-8 flag on a glob reassignment (RT#131263)
 
 * Fri Mar 31 2017 Petr Pisar <ppi...@redhat.com> - 4:5.24.1-391
 - Introduce build-conditions for groff, systemtap, syslog tests, and tcsh
-- 
cgit v1.1


        
https://src.fedoraproject.org/cgit/perl.git/commit/?h=f26&id=c297bdefcd7ea2cb480fcbcf09069feba5181c56
_______________________________________________
perl-devel mailing list -- perl-devel@lists.fedoraproject.org
To unsubscribe send an email to perl-devel-le...@lists.fedoraproject.org

Reply via email to