[pcre/f15] Fix unmatched subpattern to not become wildcard
Petr Pisar
ppisar at fedoraproject.org
Mon Jan 2 12:22:38 UTC 2012
commit 3c10b4cffbffbc6b83cd8573a4165a31f8218aaf
Author: Petr Písař <ppisar at redhat.com>
Date: Mon Jan 2 11:11:24 2012 +0100
Fix unmatched subpattern to not become wildcard
...Do-not-make-unmatched-subpattern-wildcard.patch | 74 ++++++++++++++++++++
pcre.spec | 8 ++-
2 files changed, 81 insertions(+), 1 deletions(-)
---
diff --git a/pcre-8.12-Do-not-make-unmatched-subpattern-wildcard.patch b/pcre-8.12-Do-not-make-unmatched-subpattern-wildcard.patch
new file mode 100644
index 0000000..9025062
--- /dev/null
+++ b/pcre-8.12-Do-not-make-unmatched-subpattern-wildcard.patch
@@ -0,0 +1,74 @@
+From efde8452d7312e69b776d7261782bd661ab315e2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+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 <https://bugzilla.redhat.com/show_bug.cgi?id=769597> for more
+details.
+---
+ pcre_exec.c | 7 ++++++-
+ testdata/testinput1 | 6 ++++++
+ testdata/testoutput1 | 10 ++++++++++
+ 3 files changed, 22 insertions(+), 1 deletions(-)
+
+diff --git a/pcre_exec.c b/pcre_exec.c
+index 2b7c5bd..007e054 100644
+--- a/pcre_exec.c
++++ b/pcre_exec.c
+@@ -2326,9 +2326,14 @@ 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 e45c3c1..33a5112 100644
+--- a/testdata/testinput1
++++ b/testdata/testinput1
+@@ -4085,4 +4085,10 @@
+ /(abc)\1/
+ abc
+
++/(another)?(\1?)test/
++ hello world test
++
++/(another)?(\1+)test/
++ hello world test
++
+ /-- End of testinput1 --/
+diff --git a/testdata/testoutput1 b/testdata/testoutput1
+index f1d3274..3d62b65 100644
+--- a/testdata/testoutput1
++++ b/testdata/testoutput1
+@@ -6674,4 +6674,14 @@ No match
+ abc
+ No match
+
++/(another)?(\1?)test/
++ hello world test
++ 0: test
++ 1: <unset>
++ 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 6385605..9e855ca 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -1,6 +1,6 @@
Name: pcre
Version: 8.12
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: Perl-compatible regular expression library
URL: http://www.pcre.org/
Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{name}-%{version}.tar.bz2
@@ -12,6 +12,8 @@ Patch2: pcre-8.12-forward_reference.patch
# Fix case-less match if cases differ in encoding length, in upstream after
# 8.20.
Patch3: pcre-8.12-caseless_different_length.patch
+# Bug #769597, fixed by upstream after 8.21.
+Patch4: pcre-8.12-Do-not-make-unmatched-subpattern-wildcard.patch
License: BSD
Group: System Environment/Libraries
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@@ -49,6 +51,7 @@ libtoolize --copy --force && autoreconf
%patch1 -p0 -b .caseless_reference
%patch2 -p1 -b .forward_reference
%patch3 -p1 -b .caseless_different_length
+%patch4 -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"
@@ -113,6 +116,9 @@ rm -rf $RPM_BUILD_ROOT
%doc COPYING LICENCE
%changelog
+* Mon Jan 02 2012 Petr Pisar <ppisar at redhat.com> - 8.12-6
+- Fix unmatched subpattern to not become wildcard (bug #769597)
+
* Fri Dec 02 2011 Petr Pisar <ppisar at redhat.com> - 8.12-5
- Fix case-less match if cases differ in encoding length (bug #756675)
More information about the scm-commits
mailing list