[perl/f19] Fix escaping backslashes
Petr Pisar
ppisar at fedoraproject.org
Mon Nov 11 12:20:43 UTC 2013
commit 45bdb050d07b0ceed1868014aadf83081b9b64fe
Author: Petr Písař <ppisar at redhat.com>
Date: Mon Nov 11 13:09:34 2013 +0100
Fix escaping backslashes
...f6f53ca19f99c6e9e39496c486af323ba6a8-star.patch | 96 ++++++++++++++++++++
perl.spec | 10 ++-
2 files changed, 105 insertions(+), 1 deletions(-)
---
diff --git a/perl-5.16.3-Commit-1735f6f53ca19f99c6e9e39496c486af323ba6a8-star.patch b/perl-5.16.3-Commit-1735f6f53ca19f99c6e9e39496c486af323ba6a8-star.patch
new file mode 100644
index 0000000..94a7a2c
--- /dev/null
+++ b/perl-5.16.3-Commit-1735f6f53ca19f99c6e9e39496c486af323ba6a8-star.patch
@@ -0,0 +1,96 @@
+From 8caff39ac57d2c1152fefd082119fdbff82a3e45 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=3D=3FUTF-8=3Fq=3FPetr=3D20P=3DC3=3DADsa=3DC5=3D99=3F=3D?=
+ <ppisar at redhat.com>
+Date: Fri, 8 Nov 2013 02:17:08 +0100
+Subject: [PATCH] Commit 1735f6f53ca19f99c6e9e39496c486af323ba6a8 started to
+ escape all back-slashes which breaks case when lexicon translations contain
+ substition and literals with eval-non-safe characters. E.g. these
+ translations:
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+"[_1]foo\\n\n" => "[_1]bar\\n\n",
+'[_1]foo\n' => '[_1]aÄa\n',
+
+got doubled back-slashes on the maketext() output.
+
+This patch de-escapes escaped backslashes if the literal is compiled as
+function argument.
+
+Fixes RT #120457.
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ MANIFEST | 1 +
+ dist/Locale-Maketext/lib/Locale/Maketext.pm | 1 +
+ dist/Locale-Maketext/t/91_backslash.t | 33 +++++++++++++++++++++++++++++
+ 3 files changed, 35 insertions(+)
+ create mode 100644 dist/Locale-Maketext/t/91_backslash.t
+
+diff --git a/MANIFEST b/MANIFEST
+index 397252a..09dcb37 100644
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -3281,6 +3281,7 @@ dist/Locale-Maketext/t/50_super.t See if Locale::Maketext works
+ dist/Locale-Maketext/t/60_super.t See if Locale::Maketext works
+ dist/Locale-Maketext/t/70_fail_auto.t See if Locale::Maketext works
+ dist/Locale-Maketext/t/90_utf8.t See if Locale::Maketext works
++dist/Locale-Maketext/t/91_backslash.t See if Locale::Maketext works
+ dist/Math-BigInt-FastCalc/FastCalc.xs Math::BigInt::FastCalc extension
+ dist/Math-BigInt-FastCalc/lib/Math/BigInt/FastCalc.pm Math::BigInt::FastCalc extension
+ dist/Math-BigInt-FastCalc/t/bigintfc.t Math::BigInt::FastCalc extension
+diff --git a/dist/Locale-Maketext/lib/Locale/Maketext.pm b/dist/Locale-Maketext/lib/Locale/Maketext.pm
+index 25c303b..37c0ec5 100644
+--- a/dist/Locale-Maketext/lib/Locale/Maketext.pm
++++ b/dist/Locale-Maketext/lib/Locale/Maketext.pm
+@@ -570,6 +570,7 @@ sub _compile {
+ $c[-1] = ''; # reuse this slot
+ }
+ else {
++ $c[-1] =~ s/\\\\/\\/g;
+ push @code, ' $c[' . $#c . "],\n";
+ push @c, ''; # new chunk
+ }
+diff --git a/dist/Locale-Maketext/t/91_backslash.t b/dist/Locale-Maketext/t/91_backslash.t
+new file mode 100644
+index 0000000..f96edd1
+--- /dev/null
++++ b/dist/Locale-Maketext/t/91_backslash.t
+@@ -0,0 +1,33 @@
++#!/usr/bin/perl -Tw
++
++use strict;
++use Test::More tests => 6;
++
++BEGIN {
++ use_ok( 'Locale::Maketext' );
++}
++
++use utf8;
++
++{
++ package My::Localize;
++ our @ISA = ('Locale::Maketext');
++}
++{
++ package My::Localize::cs_cz;
++ our @ISA = ('My::Localize');
++ our %Lexicon = (
++ '[_1]foo1\n' => '[_1]bar\n',
++ '[_1]foo2\n' => '[_1]běr\n',
++ 'foo2\n' => 'aěa\n',
++ "[_1]foo\\n\n" => "[_1]bar\\n\n",
++ );
++ keys %Lexicon; # dodges the 'used only once' warning
++}
++
++my $lh = My::Localize->get_handle('cs_cz');
++isa_ok( $lh, 'My::Localize::cs_cz' );
++is( $lh->maketext('[_1]foo1\n', 'arg'), 'argbar\n', 'Safe parameterized' );
++is( $lh->maketext('[_1]foo2\n', 'arg'), 'argběr\n', 'Unicode parameterized' );
++is( $lh->maketext('foo2\n'), 'aěa\n', 'Unicode literal' );
++is( $lh->maketext("[_1]foo\\n\n", 'arg'), "argbar\\n\n", 'new line parameterized' );
+--
+1.8.3.1
+
diff --git a/perl.spec b/perl.spec
index f9f722b..cb51c4f 100644
--- a/perl.spec
+++ b/perl.spec
@@ -31,7 +31,7 @@
Name: perl
Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise
-Release: 265%{?dist}
+Release: 266%{?dist}
Epoch: %{perl_epoch}
Summary: Practical Extraction and Report Language
Group: Development/Languages
@@ -126,6 +126,9 @@ Patch25: perl-5.17.9-106212-Add-PL_perlio_mutex-to-atfork_lock.patch
# RT#114878, fixed after 5.17.11
Patch26: perl-5.16.3-Remove-PERL_ASYNC_CHECK-from-Perl_leave_scope.patch
+# Fix escaping backslashes, bug #1028949, RT#120457
+Patch27: perl-5.16.3-Commit-1735f6f53ca19f99c6e9e39496c486af323ba6a8-star.patch
+
# Update some of the bundled modules
# see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
@@ -1678,6 +1681,7 @@ tarball from perl.org.
%patch24 -p1
%patch25 -p1
%patch26 -p1
+%patch27 -p1
#copy the example script
cp -a %{SOURCE5} .
@@ -1899,6 +1903,7 @@ pushd %{build_archlib}/CORE/
'Fedora Patch24: Fix leaking tied hashes (RT#107000) [3]' \
'Fedora Patch25: Fix dead lock in PerlIO after fork from thread (RT106212)' \
'Fedora Patch26: Make regexp safe in a signal handler (RT#114878)' \
+ 'Fedora Patch27: Fix escaping backslashes (RT#120457)' \
%{nil}
rm patchlevel.bak
@@ -3232,6 +3237,9 @@ sed \
# Old changelog entries are preserved in CVS.
%changelog
+* Mon Nov 11 2013 Petr Pisar <ppisar at redhat.com> - 4:5.16.3-266
+- Fix escaping backslashes (bug #1028949)
+
* Tue Jun 18 2013 Petr Pisar <ppisar at redhat.com> - 4:5.16.3-265
- Move CPANPLUS-Dist-Build files from perl-CPANPLUS
- Move CPAN-Meta-Requirements files from CPAN-Meta
More information about the scm-commits
mailing list