Fix displaying a callout position in pcretest output with an escape sequence greater than \x{ff}

This commit is contained in:
Petr Písař 2016-10-19 11:02:54 +02:00
parent 28511a24db
commit 4608e09564
2 changed files with 83 additions and 1 deletions

View File

@ -0,0 +1,74 @@
From 3caf27da49d315b53783af8e602f6be09b435bc2 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Wed, 5 Oct 2016 16:53:34 +0000
Subject: [PATCH] Fix callout display bug in pcre2test.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@557 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2test.c | 4 ++++
testdata/testinput5 | 3 +++
testdata/testoutput5 | 9 +++++++++
3 files changed, 16 insertions(+)
diff --git a/src/pcre2test.c b/src/pcre2test.c
index a8dffa3..96520e8 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -2525,6 +2525,8 @@ static int
pchar(uint32_t c, BOOL utf, FILE *f)
{
int n = 0;
+char tempbuffer[16];
+
if (PRINTOK(c))
{
if (f != NULL) fprintf(f, "%c", c);
@@ -2546,6 +2548,8 @@ if (c < 0x100)
}
if (f != NULL) n = fprintf(f, "\\x{%02x}", c);
+ else n = sprintf(tempbuffer, "\\x{%02x}", c);
+
return n >= 0 ? n : 0;
}
diff --git a/testdata/testinput5 b/testdata/testinput5
index 1f44ceb..461302a 100644
--- a/testdata/testinput5
+++ b/testdata/testinput5
@@ -1724,4 +1724,7 @@
\= Expect no match
\x{10000}
+/../utf,auto_callout
+ \n\x{123}\x{123}\x{123}\x{123}
+
# End of testinput5
diff --git a/testdata/testoutput5 b/testdata/testoutput5
index b670677..e661033 100644
--- a/testdata/testoutput5
+++ b/testdata/testoutput5
@@ -4160,4 +4160,13 @@ No match
\x{10000}
No match
+/../utf,auto_callout
+ \n\x{123}\x{123}\x{123}\x{123}
+--->\x{0a}\x{123}\x{123}\x{123}\x{123}
+ +0 ^ .
+ +0 ^ .
+ +1 ^ ^ .
+ +2 ^ ^
+ 0: \x{123}\x{123}
+
# End of testinput5
--
2.7.4

View File

@ -2,7 +2,7 @@
#%%global rcversion RC1
Name: pcre2
Version: 10.22
Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -27,6 +27,9 @@ Patch0: pcre2-10.10-Fix-multilib.patch
# without enabled UCP in a positive class, in upstream after 10.22,
# upstream bug #1866
Patch1: pcre2-10.22-Fix-bug-that-caused-chars-255-not-to-be-matched-by-c.patch
# Fix displaying a callout position in pcretest output with an escape sequence
# greater than \x{ff}, in upstream after 10.22
Patch2: pcre2-10.22-Fix-callout-display-bug-in-pcre2test.patch
# New libtool to get rid of RPATH and to use distribution autotools
BuildRequires: autoconf
BuildRequires: automake
@ -105,6 +108,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%setup -q -n %{name}-%{myversion}
%patch0 -p1
%patch1 -p1
%patch2 -p1
# Because of multilib patch
libtoolize --copy --force
autoreconf -vif
@ -201,6 +205,10 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.*
%changelog
* Wed Oct 19 2016 Petr Pisar <ppisar@redhat.com> - 10.22-3
- Fix displaying a callout position in pcretest output with an escape sequence
greater than \x{ff}
* Mon Aug 29 2016 Petr Pisar <ppisar@redhat.com> - 10.22-2
- Fix matching characters above 255 when a negative character type was used
without enabled UCP in a positive class (upstream bug #1866)