!104 [sync] PR-103: document better possible multiline matching misses
From: @openeuler-sync-bot Reviewed-by: @xujing99 Signed-off-by: @xujing99
This commit is contained in:
commit
4d9e18c8d6
@ -0,0 +1,84 @@
|
|||||||
|
From 1bc34ffa64c33381d793fb5cdddf3f484e603d23 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Carlo=20Marcelo=20Arenas=20Bel=C3=B3n?= <carenas@gmail.com>
|
||||||
|
Date: Fri, 12 May 2023 07:54:02 -0700
|
||||||
|
Subject: [PATCH] pcre2grep: document better possible multiline matching misses
|
||||||
|
(#252)
|
||||||
|
|
||||||
|
While at it, remove a misplaced cast that would cause problems for
|
||||||
|
subjects over 2GB and a few typos.
|
||||||
|
|
||||||
|
Conflict:don't modify ucptest.c because ucptest.c doesn't exist in current version.
|
||||||
|
Reference:https://github.com/PCRE2Project/pcre2/commit/1bc34ffa64c33381d793fb5cdddf3f484e603d23
|
||||||
|
---
|
||||||
|
doc/pcre2grep.1 | 11 ++++++++---
|
||||||
|
src/pcre2_compile.c | 4 ++--
|
||||||
|
src/pcre2grep.c | 2 +-
|
||||||
|
3 files changed, 11 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/doc/pcre2grep.1 b/doc/pcre2grep.1
|
||||||
|
index 1081591..5077304 100644
|
||||||
|
--- a/doc/pcre2grep.1
|
||||||
|
+++ b/doc/pcre2grep.1
|
||||||
|
@@ -66,6 +66,9 @@ The block of memory that is actually used is three times the "buffer size", to
|
||||||
|
allow for buffering "before" and "after" lines. If the buffer size is too
|
||||||
|
small, fewer than requested "before" and "after" lines may be output.
|
||||||
|
.P
|
||||||
|
+When matching with a multiline pattern, the size of the buffer must be at least
|
||||||
|
+half of the maximum match expected or the pattern might fail to match.
|
||||||
|
+.P
|
||||||
|
Patterns can be no longer than 8KiB or BUFSIZ bytes, whichever is the greater.
|
||||||
|
BUFSIZ is defined in \fB<stdio.h>\fP. When there is more than one pattern
|
||||||
|
(specified by the use of \fB-e\fP and/or \fB-f\fP), each pattern is applied to
|
||||||
|
@@ -201,7 +204,7 @@ exactly the same as the number of lines that would have been output, but if the
|
||||||
|
\fB-M\fP (multiline) option is used (without \fB-v\fP), there may be more
|
||||||
|
suppressed lines than the count (that is, the number of matches).
|
||||||
|
.sp
|
||||||
|
-If no lines are selected, the number zero is output. If several files are are
|
||||||
|
+If no lines are selected, the number zero is output. If several files are
|
||||||
|
being scanned, a count is output for each of them and the \fB-t\fP option can
|
||||||
|
be used to cause a total to be output at the end. However, if the
|
||||||
|
\fB--files-with-matches\fP option is also used, only those files whose counts
|
||||||
|
@@ -490,8 +493,10 @@ well as possibly handling a two-character newline sequence.
|
||||||
|
.sp
|
||||||
|
There is a limit to the number of lines that can be matched, imposed by the way
|
||||||
|
that \fBpcre2grep\fP buffers the input file as it scans it. With a sufficiently
|
||||||
|
-large processing buffer, this should not be a problem, but the \fB-M\fP option
|
||||||
|
-does not work when input is read line by line (see \fB--line-buffered\fP.)
|
||||||
|
+large processing buffer, this should not be a problem.
|
||||||
|
+.sp
|
||||||
|
+The \fB-M\fP option does not work when input is read line by line (see
|
||||||
|
+\fB--line-buffered\fP.)
|
||||||
|
.TP
|
||||||
|
\fB-m\fP \fInumber\fP, \fB--max-count\fP=\fInumber\fP
|
||||||
|
Stop processing after finding \fInumber\fP matching lines, or non-matching
|
||||||
|
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
|
||||||
|
index b906dc0..c6d4c60 100644
|
||||||
|
--- a/src/pcre2_compile.c
|
||||||
|
+++ b/src/pcre2_compile.c
|
||||||
|
@@ -5549,8 +5549,8 @@ for (;; pptr++)
|
||||||
|
|
||||||
|
If the class contains characters outside the 0-255 range, a different
|
||||||
|
opcode is compiled. It may optionally have a bit map for characters < 256,
|
||||||
|
- but those above are are explicitly listed afterwards. A flag code unit
|
||||||
|
- tells whether the bitmap is present, and whether this is a negated class or
|
||||||
|
+ but those above are explicitly listed afterwards. A flag code unit tells
|
||||||
|
+ whether the bitmap is present, and whether this is a negated class or
|
||||||
|
not. */
|
||||||
|
|
||||||
|
case META_CLASS_NOT:
|
||||||
|
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
|
||||||
|
index 1484d67..d2ab620 100644
|
||||||
|
--- a/src/pcre2grep.c
|
||||||
|
+++ b/src/pcre2grep.c
|
||||||
|
@@ -1856,7 +1856,7 @@ if (slen > 200)
|
||||||
|
|
||||||
|
for (int i = 1; p != NULL; p = p->next, i++)
|
||||||
|
{
|
||||||
|
- int rc = pcre2_match(p->compiled, (PCRE2_SPTR)matchptr, (int)length,
|
||||||
|
+ int rc = pcre2_match(p->compiled, (PCRE2_SPTR)matchptr, length,
|
||||||
|
startoffset, options, match_data, match_context);
|
||||||
|
if (rc == PCRE2_ERROR_NOMATCH) continue;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: pcre2
|
Name: pcre2
|
||||||
Version: 10.42
|
Version: 10.42
|
||||||
Release: 7
|
Release: 8
|
||||||
Summary: Perl Compatible Regular Expressions
|
Summary: Perl Compatible Regular Expressions
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: http://www.pcre.org/
|
URL: http://www.pcre.org/
|
||||||
@ -29,6 +29,7 @@ Patch6017: backport-Fix-backreferences-with-unset-backref-and-non-greedy.pat
|
|||||||
Patch6018: backport-Sanity-checks-for-ctype-functions-342.patch
|
Patch6018: backport-Sanity-checks-for-ctype-functions-342.patch
|
||||||
Patch6019: backport-Fix-incorrect-class-character-matches-in-JIT.patch
|
Patch6019: backport-Fix-incorrect-class-character-matches-in-JIT.patch
|
||||||
Patch6020: backport-Fixing-an-issue-using-empty-character-sets-in-jit.patch
|
Patch6020: backport-Fixing-an-issue-using-empty-character-sets-in-jit.patch
|
||||||
|
Patch6021: backport-pcre2grep-document-better-possible-multiline-matchin.patch
|
||||||
|
|
||||||
BuildRequires: autoconf libtool automake coreutils gcc make readline-devel
|
BuildRequires: autoconf libtool automake coreutils gcc make readline-devel
|
||||||
Obsoletes: pcre2-utf16 pcre2-utf32 pcre2-tools
|
Obsoletes: pcre2-utf16 pcre2-utf32 pcre2-tools
|
||||||
@ -146,6 +147,9 @@ make check
|
|||||||
%{_pkgdocdir}/html/
|
%{_pkgdocdir}/html/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jul 23 2024 fuanan <fuanan3@h-partners.com> - 10.42-8
|
||||||
|
- DESC:document better possible multiline matching misses
|
||||||
|
|
||||||
* Tue May 07 2024 xujing <xujing125@huawei.com> - 10.42-7
|
* Tue May 07 2024 xujing <xujing125@huawei.com> - 10.42-7
|
||||||
- DESC:Fixing an issue using empty character sets in jit
|
- DESC:Fixing an issue using empty character sets in jit
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user