From 404ec6765648672a28ed5c0c61c4e00b044f923a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 2 Jan 2012 11:11:24 +0100 Subject: [PATCH] Fix unmatched subpattern to not become wildcard --- ...t-make-unmatched-subpattern-wildcard.patch | 73 +++++++++++++++++++ pcre.spec | 8 +- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 pcre-8.21-Do-not-make-unmatched-subpattern-wildcard.patch diff --git a/pcre-8.21-Do-not-make-unmatched-subpattern-wildcard.patch b/pcre-8.21-Do-not-make-unmatched-subpattern-wildcard.patch new file mode 100644 index 0000000..9f7008d --- /dev/null +++ b/pcre-8.21-Do-not-make-unmatched-subpattern-wildcard.patch @@ -0,0 +1,73 @@ +From 1daa2332fb112a2868957e0ed42242e6115d0d72 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Mon, 2 Jan 2012 10:56:09 +0100 +Subject: [PATCH] Do not make unmatched subpattern wildcard + +Back-ported from: +r836 | ph10 | 2011-12-28 18:16:11 +0100 (St, 28 pro 2011) | 2 lines +Merging all the changes from the pcre16 branch into the trunk. + +See for more +details. +--- + pcre_exec.c | 6 +++++- + testdata/testinput1 | 6 ++++++ + testdata/testoutput1 | 10 ++++++++++ + 3 files changed, 21 insertions(+), 1 deletions(-) + +diff --git a/pcre_exec.c b/pcre_exec.c +index 46498d5..a7cec30 100644 +--- a/pcre_exec.c ++++ b/pcre_exec.c +@@ -2620,9 +2620,13 @@ for (;;) + } + + /* Handle repeated back references. If the length of the reference is +- zero, just continue with the main loop. */ ++ zero, just continue with the main loop. If the length is negative, it ++ means the reference is unset in non-Java-compatible mode. If the minimum is ++ zero, we can continue at the same level without recursion. For any other ++ minimum, carrying on will result in NOMATCH. */ + + if (length == 0) continue; ++ if (length < 0 && min == 0) continue; + + /* First, ensure the minimum number of matches are present. We get back + the length of the reference string explicitly rather than passing the +diff --git a/testdata/testinput1 b/testdata/testinput1 +index 36d7028..b41de5a 100644 +--- a/testdata/testinput1 ++++ b/testdata/testinput1 +@@ -4318,4 +4318,10 @@ + /a[\C-X]b/ + aJb + ++/(another)?(\1?)test/ ++ hello world test ++ ++/(another)?(\1+)test/ ++ hello world test ++ + /-- End of testinput1 --/ +diff --git a/testdata/testoutput1 b/testdata/testoutput1 +index bc237ab..2357ddb 100644 +--- a/testdata/testoutput1 ++++ b/testdata/testoutput1 +@@ -7053,4 +7053,14 @@ No match + aJb + 0: aJb + ++/(another)?(\1?)test/ ++ hello world test ++ 0: test ++ 1: ++ 2: ++ ++/(another)?(\1+)test/ ++ hello world test ++No match ++ + /-- End of testinput1 --/ +-- +1.7.7.5 + diff --git a/pcre.spec b/pcre.spec index 052acd9..0655b97 100644 --- a/pcre.spec +++ b/pcre.spec @@ -2,7 +2,7 @@ #%%global rcversion RC1 Name: pcre Version: 8.21 -Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist} +Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library Group: System Environment/Libraries @@ -13,6 +13,8 @@ Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/%{name}/%{?rcversion:Te Patch0: pcre-8.21-multilib.patch # Refused by upstream, bug #675477 Patch1: pcre-8.20-refused_spelling_terminated.patch +# Bug #769597, fixed by upstream after 8.21. +Patch2: pcre-8.21-Do-not-make-unmatched-subpattern-wildcard.patch BuildRequires: readline-devel # New libtool to get rid of rpath BuildRequires: autoconf, automake, libtool @@ -53,6 +55,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 .unmatched_subpattern # One contributor's name is non-UTF-8 for F in ChangeLog; do iconv -f latin1 -t utf8 "$F" >"${F}.utf8" @@ -123,6 +126,9 @@ make check %{_mandir}/man1/pcretest.* %changelog +* Mon Jan 02 2012 Petr Pisar - 8.21-2 +- Fix unmatched subpattern to not become wildcard (bug #769597) + * Mon Dec 12 2011 Petr Pisar - 8.21-1 - 8.21 bump