Fix look-behind regression in 8.20

This commit is contained in:
Petr Písař 2011-11-15 16:38:00 +01:00
parent dfafe2bb25
commit 381787cb6b
2 changed files with 91 additions and 1 deletions

View File

@ -0,0 +1,84 @@
From ad81574f3cd7aef3e7d9106d6fa86901556b1731 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 15 Nov 2011 16:34:01 +0100
Subject: [PATCH] Caseless matching of backreferences with fixed length
repetitions was broken.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
From development SVN tree:
r746 | ph10 | 2011-11-15 16:07:02 +0100 (Út, 15 lis 2011) | 2 lines
6. Lookbehinds such as (?<=a{2}b) that contained a fixed repetition were
erroneously being rejected as "not fixed length" if PCRE_CASELESS was set.
This bug was probably introduced by change 9 of 8.13.
Petr Pisar: Changelog entry removed.
See <https://lists.exim.org/lurker/thread/20111115.150810.f771a73e.en.html>.
---
pcre_compile.c | 1 +
testdata/testinput1 | 10 ++++++++++
testdata/testoutput1 | 16 ++++++++++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/pcre_compile.c b/pcre_compile.c
index 3fc7c82..588e981 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -1595,6 +1595,7 @@ for (;;)
need to skip over a multibyte character in UTF8 mode. */
case OP_EXACT:
+ case OP_EXACTI:
branchlength += GET2(cc,1);
cc += 4;
#ifdef SUPPORT_UTF8
diff --git a/testdata/testinput1 b/testdata/testinput1
index c913ee4..aa9ce42 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -4251,4 +4251,14 @@
/[:a]xxx[b:]/
:xxx:
+/(?<=a{2})b/i
+ xaabc
+ ** Failers
+ xabc
+
+/(?<!a{2})b/i
+ xabc
+ ** Failers
+ xaabc
+
/-- End of testinput1 --/
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index 030f04f..5a025e2 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -6952,4 +6952,20 @@ No match
:xxx:
0: :xxx:
+/(?<=a{2})b/i
+ xaabc
+ 0: b
+ ** Failers
+No match
+ xabc
+No match
+
+/(?<!a{2})b/i
+ xabc
+ 0: b
+ ** Failers
+No match
+ xaabc
+No match
+
/-- End of testinput1 --/
--
1.7.6.4

View File

@ -1,7 +1,7 @@
# This is stable release: %%global rcversion RC3
Name: pcre
Version: 8.20
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
@ -11,6 +11,8 @@ Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/%{name}/%{?rcversion:Te
Patch0: pcre-8.10-multilib.patch
# Refused by upstream, bug #675477
Patch1: pcre-8.20-refused_spelling_terminated.patch
# Fix look-behind regression, in upstream after 8.20.
Patch2: pcre-8.20-lookbehind.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@ -51,6 +53,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch0 -p1 -b .multilib
libtoolize --copy --force && autoreconf
%patch1 -p1 -b .terminated_typos
%patch2 -p1 -b .lookbehind
# One contributor's name is non-UTF-8
for F in ChangeLog; do
iconv -f latin1 -t utf8 "$F" >"${F}.utf8"
@ -121,6 +124,9 @@ make check
%{_mandir}/man1/pcretest.*
%changelog
* Tue Nov 15 2011 Petr Pisar <ppisar@redhat.com> - 8.20-3
- Fix look-behind regression in 8.20
* Tue Nov 15 2011 Dan Horák <dan[at]danny.cz> - 8.20-2
- fix build on s390(x) - disable jit and use larger stack for tests