Ignore offset modifier in pcre2test in POSIX mode

This commit is contained in:
Petr Písař 2016-10-24 10:27:01 +02:00
parent 249ffc0f72
commit 3cab1f40be
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,66 @@
From f93df8c28fb7e00063612edaff46c3e9ad46e99d Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Sun, 23 Oct 2016 16:18:15 +0000
Subject: [PATCH] The "offset" modifier in pcre2test was not being ignored (as
documented) for POSIX.
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@576 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.22
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 039a4f0..30fd190 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -6065,6 +6065,7 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
if (dat_datctl.get_numbers[0] >= 0 || dat_datctl.get_names[0] != 0)
prmsg(&msg, "get");
if (dat_datctl.jitstack != 0) prmsg(&msg, "jitstack");
+ if (dat_datctl.offset != 0) prmsg(&msg, "offset");
if ((dat_datctl.options & ~POSIX_SUPPORTED_MATCH_OPTIONS) != 0)
{
@@ -6087,9 +6088,8 @@ if ((pat_patctl.control & CTL_POSIX) != 0)
if ((dat_datctl.options & PCRE2_NOTBOL) != 0) eflags |= REG_NOTBOL;
if ((dat_datctl.options & PCRE2_NOTEOL) != 0) eflags |= REG_NOTEOL;
if ((dat_datctl.options & PCRE2_NOTEMPTY) != 0) eflags |= REG_NOTEMPTY;
-
- rc = regexec(&preg, (const char *)pp + dat_datctl.offset,
- dat_datctl.oveccount, pmatch, eflags);
+
+ rc = regexec(&preg, (const char *)pp, dat_datctl.oveccount, pmatch, eflags);
if (rc != 0)
{
(void)regerror(rc, &preg, (char *)pbuffer8, pbuffer8_size);
diff --git a/testdata/testinput18 b/testdata/testinput18
index e31b96e..ea47a4d 100644
--- a/testdata/testinput18
+++ b/testdata/testinput18
@@ -103,4 +103,7 @@
/\[A]{1000000}**/expand,regerror_buffsize=32
+//posix_nosub
+ \=offset=70000
+
# End of testdata/testinput18
diff --git a/testdata/testoutput18 b/testdata/testoutput18
index 3df298c..e2eb009 100644
--- a/testdata/testoutput18
+++ b/testdata/testoutput18
@@ -157,4 +157,9 @@ Failed: POSIX code 4: ? * + invalid at offset 100000
/\[A]{1000000}**/expand,regerror_buffsize=32
Failed: POSIX code 4: ? * + invalid at offset 1000001
+//posix_nosub
+ \=offset=70000
+** Ignored with POSIX interface: offset
+Matched with REG_NOSUB
+
# End of testdata/testinput18
--
2.7.4

View File

@ -49,6 +49,9 @@ Patch8: pcre2-10.22-Fix-optimization-bugs-when-pattern-starts-with-looka.pat
# Document assert capture limitation, in upstream after 10.22,
# upstream bug #1887
Patch9: pcre2-10.22-Document-current-assert-capture-limitation.patch
# Ignore offset modifier in pcre2test in POSIX mode, in upstream after 10.22,
# upstream bug #1898
Patch10: pcre2-10.22-The-offset-modifier-in-pcre2test-was-not-being-ignor.patch
# New libtool to get rid of RPATH and to use distribution autotools
BuildRequires: autoconf
BuildRequires: automake
@ -135,6 +138,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
# Because of multilib patch
libtoolize --copy --force
autoreconf -vif
@ -233,6 +237,7 @@ make %{?_smp_mflags} check VERBOSE=yes
%changelog
* Mon Oct 24 2016 Petr Pisar <ppisar@redhat.com> - 10.22-5
- Document assert capture limitation (upstream bug #1887)
- Ignore offset modifier in pcre2test in POSIX mode (upstream bug #1898)
* Wed Oct 19 2016 Richard W.M. Jones <@redhat.com> - 10.22-4
- Disable the JIT on riscv64.