From fd6a3698c1083f6635a5e15dbf77a9210307ccc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Mon, 15 Jan 2018 12:04:06 +0100 Subject: [PATCH] 10.31-RC1 bump --- .gitignore | 1 + ...-line-number-and-count-variables-to-.patch | 137 ------- pcre2-10.30-Documentation-update.patch | 174 -------- ...10.30-FIRSTLINE_documentation-update.patch | 61 --- pcre2-10.30-Fix-K-issues-in-pcre2grep.patch | 149 ------- ...INE-bug-when-a-pattern-match-starts-.patch | 206 ---------- ...rst-matching-character-when-a-backre.patch | 91 ----- ...issue-introduced-in-last-bug-fix-in-.patch | 32 -- ...ltiline-matching-issues-in-pcre2grep.patch | 383 ------------------ ...0.30-Fix-pcre2_jit_match-early-check.patch | 28 -- ...rep-recursive-file-name-length-issue.patch | 52 --- ...s-FIRSTLINE-patch-was-broken.-Fix-it.patch | 218 ---------- pcre2-10.30-Remove-superflous-variable.patch | 105 ----- ...-to-deal-with-various-K-inside-asser.patch | 96 ----- pcre2.spec | 80 +--- sources | 2 +- 16 files changed, 23 insertions(+), 1792 deletions(-) delete mode 100644 pcre2-10.30-Change-pcre2grep-line-number-and-count-variables-to-.patch delete mode 100644 pcre2-10.30-Documentation-update.patch delete mode 100644 pcre2-10.30-FIRSTLINE_documentation-update.patch delete mode 100644 pcre2-10.30-Fix-K-issues-in-pcre2grep.patch delete mode 100644 pcre2-10.30-Fix-PCRE2_FIRSTLINE-bug-when-a-pattern-match-starts-.patch delete mode 100644 pcre2-10.30-Fix-incorrect-first-matching-character-when-a-backre.patch delete mode 100644 pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch delete mode 100644 pcre2-10.30-Fix-multiple-multiline-matching-issues-in-pcre2grep.patch delete mode 100644 pcre2-10.30-Fix-pcre2_jit_match-early-check.patch delete mode 100644 pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch delete mode 100644 pcre2-10.30-Previous-FIRSTLINE-patch-was-broken.-Fix-it.patch delete mode 100644 pcre2-10.30-Remove-superflous-variable.patch delete mode 100644 pcre2-10.30-Update-pcre2demo-to-deal-with-various-K-inside-asser.patch diff --git a/.gitignore b/.gitignore index 819ab60..6db680b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /pcre2-10.23.tar.bz2 /pcre2-10.30-RC1.tar.bz2 /pcre2-10.30.tar.bz2 +/pcre2-10.31-RC1.tar.bz2 diff --git a/pcre2-10.30-Change-pcre2grep-line-number-and-count-variables-to-.patch b/pcre2-10.30-Change-pcre2grep-line-number-and-count-variables-to-.patch deleted file mode 100644 index 34421cf..0000000 --- a/pcre2-10.30-Change-pcre2grep-line-number-and-count-variables-to-.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 43e13d367d3f442ace4ce1cf43d9c2b27e2226bb Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Fri, 8 Dec 2017 10:25:49 +0000 -Subject: [PATCH] Change pcre2grep line number and count variables to unsigned - long int. -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@887 6239d852-aaf2-0410-a92c-79f79f948069 - -Petr Písař: Port to 10.30. -diff --git a/src/pcre2grep.c b/src/pcre2grep.c -index c7c95c5..e764313 100644 ---- a/src/pcre2grep.c -+++ b/src/pcre2grep.c -@@ -196,8 +196,9 @@ static int bufthird = PCRE2GREP_BUFSIZE; - static int max_bufthird = PCRE2GREP_MAX_BUFSIZE; - static int bufsize = 3*PCRE2GREP_BUFSIZE; - static int endlinetype; --static int total_count = 0; --static int counts_printed = 0; -+ -+static unsigned long int total_count = 0; -+static unsigned long int counts_printed = 0; - - #ifdef WIN32 - static int dee_action = dee_SKIP; -@@ -1606,8 +1607,8 @@ Returns: nothing - */ - - static void --do_after_lines(int lastmatchnumber, char *lastmatchrestart, char *endptr, -- const char *printname) -+do_after_lines(unsigned long int lastmatchnumber, char *lastmatchrestart, -+ char *endptr, const char *printname) - { - if (after_context > 0 && lastmatchnumber > 0) - { -@@ -1618,7 +1619,7 @@ if (after_context > 0 && lastmatchnumber > 0) - char *pp = end_of_line(lastmatchrestart, endptr, &ellength); - if (ellength == 0 && pp == main_buffer + bufsize) break; - if (printname != NULL) fprintf(stdout, "%s-", printname); -- if (number) fprintf(stdout, "%d-", lastmatchnumber++); -+ if (number) fprintf(stdout, "%lu-", lastmatchnumber++); - FWRITE_IGNORE(lastmatchrestart, 1, pp - lastmatchrestart, stdout); - lastmatchrestart = pp; - count++; -@@ -2309,10 +2310,10 @@ static int - pcre2grep(void *handle, int frtype, const char *filename, const char *printname) - { - int rc = 1; --int linenumber = 1; --int lastmatchnumber = 0; --int count = 0; - int filepos = 0; -+unsigned long int linenumber = 1; -+unsigned long int lastmatchnumber = 0; -+unsigned long int count = 0; - char *lastmatchrestart = NULL; - char *ptr = main_buffer; - char *endptr; -@@ -2400,7 +2401,7 @@ while (ptr < endptr) - if (new_buffer == NULL) - { - fprintf(stderr, -- "pcre2grep: line %d%s%s is too long for the internal buffer\n" -+ "pcre2grep: line %lu%s%s is too long for the internal buffer\n" - "pcre2grep: not enough memory to increase the buffer size to %d\n", - linenumber, - (filename == NULL)? "" : " of file ", -@@ -2430,7 +2431,7 @@ while (ptr < endptr) - else - { - fprintf(stderr, -- "pcre2grep: line %d%s%s is too long for the internal buffer\n" -+ "pcre2grep: line %lu%s%s is too long for the internal buffer\n" - "pcre2grep: the maximum buffer size is %d\n" - "pcre2grep: use the --max-buffer-size option to change it\n", - linenumber, -@@ -2562,7 +2563,7 @@ while (ptr < endptr) - size_t oldstartoffset; - - if (printname != NULL) fprintf(stdout, "%s:", printname); -- if (number) fprintf(stdout, "%d:", linenumber); -+ if (number) fprintf(stdout, "%lu:", linenumber); - - /* Handle --line-offsets */ - -@@ -2682,7 +2683,7 @@ while (ptr < endptr) - { - char *pp = lastmatchrestart; - if (printname != NULL) fprintf(stdout, "%s-", printname); -- if (number) fprintf(stdout, "%d-", lastmatchnumber++); -+ if (number) fprintf(stdout, "%lu-", lastmatchnumber++); - pp = end_of_line(pp, endptr, &ellength); - FWRITE_IGNORE(lastmatchrestart, 1, pp - lastmatchrestart, stdout); - lastmatchrestart = pp; -@@ -2722,7 +2723,7 @@ while (ptr < endptr) - int ellength; - char *pp = p; - if (printname != NULL) fprintf(stdout, "%s-", printname); -- if (number) fprintf(stdout, "%d-", linenumber - linecount--); -+ if (number) fprintf(stdout, "%lu-", linenumber - linecount--); - pp = end_of_line(pp, endptr, &ellength); - FWRITE_IGNORE(p, 1, pp - p, stdout); - p = pp; -@@ -2736,7 +2737,7 @@ while (ptr < endptr) - endhyphenpending = TRUE; - - if (printname != NULL) fprintf(stdout, "%s:", printname); -- if (number) fprintf(stdout, "%d:", linenumber); -+ if (number) fprintf(stdout, "%lu:", linenumber); - - /* This extra option, for Jeffrey Friedl's debugging requirements, - replaces the matched string, or a specific captured string if it exists, -@@ -2918,7 +2919,7 @@ if (count_only && !quiet) - { - if (printname != NULL && filenames != FN_NONE) - fprintf(stdout, "%s:", printname); -- fprintf(stdout, "%d" STDOUT_NL, count); -+ fprintf(stdout, "%lu" STDOUT_NL, count); - counts_printed++; - } - } -@@ -4196,7 +4197,7 @@ if (show_total_count && counts_printed != 1 && filenames != FN_NOMATCH_ONLY) - { - if (counts_printed != 0 && filenames >= FN_DEFAULT) - fprintf(stdout, "TOTAL:"); -- fprintf(stdout, "%d" STDOUT_NL, total_count); -+ fprintf(stdout, "%lu" STDOUT_NL, total_count); - } - - EXIT: --- -2.13.6 - diff --git a/pcre2-10.30-Documentation-update.patch b/pcre2-10.30-Documentation-update.patch deleted file mode 100644 index fa646cc..0000000 --- a/pcre2-10.30-Documentation-update.patch +++ /dev/null @@ -1,174 +0,0 @@ -From c26d49eda45dd8a26e1de65a4430e84116266227 Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Sun, 24 Dec 2017 10:27:13 +0000 -Subject: [PATCH 2/3] Documentation update. -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@895 6239d852-aaf2-0410-a92c-79f79f948069 -Signed-off-by: Petr Písař ---- - doc/html/pcre2demo.html | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ - doc/pcre2demo.3 | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 106 insertions(+) - -diff --git a/doc/html/pcre2demo.html b/doc/html/pcre2demo.html -index d64e16b..72754d3 100644 ---- a/doc/html/pcre2demo.html -+++ b/doc/html/pcre2demo.html -@@ -228,6 +228,21 @@ pcre2_match_data_create_from_pattern() above. */ - if (rc == 0) - printf("ovector was not big enough for all the captured substrings\n"); - -+/* We must guard against patterns such as /(?=.\K)/ that use \K in an assertion -+to set the start of a match later than its end. In this demonstration program, -+we just detect this case and give up. */ -+ -+if (ovector[0] > ovector[1]) -+ { -+ printf("\\K was used in an assertion to set the match start after its end.\n" -+ "From end to start the match was: %.*s\n", (int)(ovector[0] - ovector[1]), -+ (char *)(subject + ovector[1])); -+ printf("Run abandoned\n"); -+ pcre2_match_data_free(match_data); -+ pcre2_code_free(re); -+ return 1; -+ } -+ - /* Show substrings stored in the output vector by number. Obviously, in a real - application you might want to do things other than print them. */ - -@@ -355,6 +370,29 @@ for (;;) - options = PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED; - } - -+ /* If the previous match was not an empty string, there is one tricky case to -+ consider. If a pattern contains \K within a lookbehind assertion at the -+ start, the end of the matched string can be at the offset where the match -+ started. Without special action, this leads to a loop that keeps on matching -+ the same substring. We must detect this case and arrange to move the start on -+ by one character. The pcre2_get_startchar() function returns the starting -+ offset that was passed to pcre2_match(). */ -+ -+ else -+ { -+ PCRE2_SIZE startchar = pcre2_get_startchar(match_data); -+ if (start_offset <= startchar) -+ { -+ if (startchar >= subject_length) break; /* Reached end of subject. */ -+ start_offset = startchar + 1; /* Advance by one character. */ -+ if (utf8) /* If UTF-8, it may be more */ -+ { /* than one code unit. */ -+ for (; start_offset < subject_length; start_offset++) -+ if ((subject[start_offset] & 0xc0) != 0x80) break; -+ } -+ } -+ } -+ - /* Run the next matching operation */ - - rc = pcre2_match( -@@ -419,6 +457,21 @@ for (;;) - if (rc == 0) - printf("ovector was not big enough for all the captured substrings\n"); - -+ /* We must guard against patterns such as /(?=.\K)/ that use \K in an -+ assertion to set the start of a match later than its end. In this -+ demonstration program, we just detect this case and give up. */ -+ -+ if (ovector[0] > ovector[1]) -+ { -+ printf("\\K was used in an assertion to set the match start after its end.\n" -+ "From end to start the match was: %.*s\n", (int)(ovector[0] - ovector[1]), -+ (char *)(subject + ovector[1])); -+ printf("Run abandoned\n"); -+ pcre2_match_data_free(match_data); -+ pcre2_code_free(re); -+ return 1; -+ } -+ - /* As before, show substrings stored in the output vector by number, and then - also any named substrings. */ - -diff --git a/doc/pcre2demo.3 b/doc/pcre2demo.3 -index c02dcd9..a9e58e2 100644 ---- a/doc/pcre2demo.3 -+++ b/doc/pcre2demo.3 -@@ -228,6 +228,21 @@ pcre2_match_data_create_from_pattern() above. */ - if (rc == 0) - printf("ovector was not big enough for all the captured substrings\en"); - -+/* We must guard against patterns such as /(?=.\eK)/ that use \eK in an assertion -+to set the start of a match later than its end. In this demonstration program, -+we just detect this case and give up. */ -+ -+if (ovector[0] > ovector[1]) -+ { -+ printf("\e\eK was used in an assertion to set the match start after its end.\en" -+ "From end to start the match was: %.*s\en", (int)(ovector[0] - ovector[1]), -+ (char *)(subject + ovector[1])); -+ printf("Run abandoned\en"); -+ pcre2_match_data_free(match_data); -+ pcre2_code_free(re); -+ return 1; -+ } -+ - /* Show substrings stored in the output vector by number. Obviously, in a real - application you might want to do things other than print them. */ - -@@ -355,6 +370,29 @@ for (;;) - options = PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED; - } - -+ /* If the previous match was not an empty string, there is one tricky case to -+ consider. If a pattern contains \eK within a lookbehind assertion at the -+ start, the end of the matched string can be at the offset where the match -+ started. Without special action, this leads to a loop that keeps on matching -+ the same substring. We must detect this case and arrange to move the start on -+ by one character. The pcre2_get_startchar() function returns the starting -+ offset that was passed to pcre2_match(). */ -+ -+ else -+ { -+ PCRE2_SIZE startchar = pcre2_get_startchar(match_data); -+ if (start_offset <= startchar) -+ { -+ if (startchar >= subject_length) break; /* Reached end of subject. */ -+ start_offset = startchar + 1; /* Advance by one character. */ -+ if (utf8) /* If UTF-8, it may be more */ -+ { /* than one code unit. */ -+ for (; start_offset < subject_length; start_offset++) -+ if ((subject[start_offset] & 0xc0) != 0x80) break; -+ } -+ } -+ } -+ - /* Run the next matching operation */ - - rc = pcre2_match( -@@ -419,6 +457,21 @@ for (;;) - if (rc == 0) - printf("ovector was not big enough for all the captured substrings\en"); - -+ /* We must guard against patterns such as /(?=.\eK)/ that use \eK in an -+ assertion to set the start of a match later than its end. In this -+ demonstration program, we just detect this case and give up. */ -+ -+ if (ovector[0] > ovector[1]) -+ { -+ printf("\e\eK was used in an assertion to set the match start after its end.\en" -+ "From end to start the match was: %.*s\en", (int)(ovector[0] - ovector[1]), -+ (char *)(subject + ovector[1])); -+ printf("Run abandoned\en"); -+ pcre2_match_data_free(match_data); -+ pcre2_code_free(re); -+ return 1; -+ } -+ - /* As before, show substrings stored in the output vector by number, and then - also any named substrings. */ - --- -2.13.6 - diff --git a/pcre2-10.30-FIRSTLINE_documentation-update.patch b/pcre2-10.30-FIRSTLINE_documentation-update.patch deleted file mode 100644 index 11b9a3e..0000000 --- a/pcre2-10.30-FIRSTLINE_documentation-update.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 3fdced6eef96f50ac5bd287426db0aa699be3edc Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Sun, 31 Dec 2017 17:44:12 +0000 -Subject: [PATCH] Documentation update. -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@898 6239d852-aaf2-0410-a92c-79f79f948069 -Petr Písař: Ported to 10.30. - -Signed-off-by: Petr Písař ---- - doc/pcre2api.3 | 24 +++++++++++++++--------- - 1 file changed, 15 insertions(+), 9 deletions(-) - -diff --git a/doc/pcre2api.3 b/doc/pcre2api.3 -index f80ae58..d55debf 100644 ---- a/doc/pcre2api.3 -+++ b/doc/pcre2api.3 -@@ -871,10 +871,11 @@ compiled. If a match is started with a non-default match limit when - PCRE2_USE_OFFSET_LIMIT is not set, an error is generated. - .P - The offset limit facility can be used to track progress when searching large --subject strings. See also the PCRE2_FIRSTLINE option, which requires a match to --start within the first line of the subject. If this is set with an offset --limit, a match must occur in the first line and also within the offset limit. --In other words, whichever limit comes first is used. -+subject strings. See also the PCRE2_FIRSTLINE option, which requires a match -+to start before or at the first newline that follows the start of matching in -+the subject. If this is set with an offset limit, a match must occur in the -+first line and also within the offset limit. In other words, whichever limit -+comes first is used. - .sp - .nf - .B int pcre2_set_heap_limit(pcre2_match_context *\fImcontext\fP, -@@ -1423,11 +1424,16 @@ changed within a pattern by a (?xx) option setting. - PCRE2_FIRSTLINE - .sp - If this option is set, the start of an unanchored pattern match must be before --or at the first newline in the subject string, though the matched text may --continue over the newline. See also PCRE2_USE_OFFSET_LIMIT, which provides a --more general limiting facility. If PCRE2_FIRSTLINE is set with an offset limit, --a match must occur in the first line and also within the offset limit. In other --words, whichever limit comes first is used. -+or at the first newline in the subject string following the start of matching, -+though the matched text may continue over the newline. If \fIstartoffset\fP is -+non-zero, the limiting newline is not necessarily the first newline in the -+subject. For example, if the subject string is "abc\enxyz" (where \en -+represents a single-character newline) a pattern match for "yz" succeeds with -+PCRE2_FIRSTLINE if \fIstartoffset\fP is greater than 3. See also -+PCRE2_USE_OFFSET_LIMIT, which provides a more general limiting facility. If -+PCRE2_FIRSTLINE is set with an offset limit, a match must occur in the first -+line and also within the offset limit. In other words, whichever limit comes -+first is used. - .sp - PCRE2_LITERAL - .sp --- -2.13.6 - diff --git a/pcre2-10.30-Fix-K-issues-in-pcre2grep.patch b/pcre2-10.30-Fix-K-issues-in-pcre2grep.patch deleted file mode 100644 index 3100386..0000000 --- a/pcre2-10.30-Fix-K-issues-in-pcre2grep.patch +++ /dev/null @@ -1,149 +0,0 @@ -From a109c9e35a040a7a8032c12ce7396bc949f3f735 Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Tue, 26 Dec 2017 15:10:04 +0000 -Subject: [PATCH 3/3] Fix \K issues in pcre2grep. -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@896 6239d852-aaf2-0410-a92c-79f79f948069 -Petr Písař: Ported to 10.30. ---- - RunGrepTest | 11 +++++++++++ - src/pcre2grep.c | 49 ++++++++++++++++++++++++++++++++++++++++++++----- - testdata/grepoutput | 9 +++++++++ - -diff --git a/RunGrepTest b/RunGrepTest -index a7496cb..a26f677 100755 ---- a/RunGrepTest -+++ b/RunGrepTest -@@ -630,6 +630,17 @@ echo "RC=$?" >>testtrygrep - (cd $srcdir; $valgrind $vjs $pcre2grep -Mn -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep - echo "RC=$?" >>testtrygrep - -+echo "---------------------------- Test 125 -----------------------------" >>testtrygrep -+printf "abcd\n" >testNinputgrep -+$valgrind $vjs $pcre2grep --colour=always '(?<=\K.)' testNinputgrep >>testtrygrep -+echo "RC=$?" >>testtrygrep -+$valgrind $vjs $pcre2grep --colour=always '(?=.\K)' testNinputgrep >>testtrygrep -+echo "RC=$?" >>testtrygrep -+$valgrind $vjs $pcre2grep --colour=always '(?<=\K[ac])' testNinputgrep >>testtrygrep -+echo "RC=$?" >>testtrygrep -+$valgrind $vjs $pcre2grep --colour=always '(?=[ac]\K)' testNinputgrep >>testtrygrep -+echo "RC=$?" >>testtrygrep -+ - - # Now compare the results. - -diff --git a/src/pcre2grep.c b/src/pcre2grep.c -index e764313..02339f5 100644 ---- a/src/pcre2grep.c -+++ b/src/pcre2grep.c -@@ -1607,7 +1607,7 @@ Returns: nothing - */ - - static void --do_after_lines(unsigned long int lastmatchnumber, char *lastmatchrestart, -+do_after_lines(unsigned long int lastmatchnumber, char *lastmatchrestart, - char *endptr, const char *printname) - { - if (after_context > 0 && lastmatchnumber > 0) -@@ -2764,11 +2764,38 @@ while (ptr < endptr) - if ((multiline || do_colour) && !invert) - { - int plength; -+ PCRE2_SIZE endprevious; -+ -+ /* The use of \K may make the end offset earlier than the start. In -+ this situation, swap them round. */ -+ -+ if (offsets[0] > offsets[1]) -+ { -+ PCRE2_SIZE temp = offsets[0]; -+ offsets[0] = offsets[1]; -+ offsets[1] = temp; -+ } -+ - FWRITE_IGNORE(ptr, 1, offsets[0], stdout); - print_match(ptr + offsets[0], offsets[1] - offsets[0]); -+ - for (;;) - { -- startoffset = offsets[1]; /* Advance after previous match. */ -+ PCRE2_SIZE oldstartoffset = pcre2_get_startchar(match_data); -+ -+ endprevious = offsets[1]; -+ startoffset = endprevious; /* Advance after previous match. */ -+ -+ /* If the pattern contained a lookbehind that included \K, it is -+ possible that the end of the match might be at or before the actual -+ starting offset we have just used. In this case, start one character -+ further on. */ -+ -+ if (startoffset <= oldstartoffset) -+ { -+ startoffset = oldstartoffset + 1; -+ if (utf) while ((ptr[startoffset] & 0xc0) == 0x80) startoffset++; -+ } - - /* If the current match ended past the end of the line (only possible - in multiline mode), we must move on to the line in which it did end -@@ -2782,6 +2809,7 @@ while (ptr < endptr) - filepos += (int)(linelength + endlinelength); - linenumber++; - startoffset -= (int)(linelength + endlinelength); -+ endprevious -= (int)(linelength + endlinelength); - t = end_of_line(ptr, endptr, &endlinelength); - linelength = t - ptr - endlinelength; - length = (size_t)(endptr - ptr); -@@ -2797,7 +2825,18 @@ while (ptr < endptr) - loop for any that may follow. */ - - if (!match_patterns(ptr, length, options, startoffset, &mrc)) break; -- FWRITE_IGNORE(ptr + startoffset, 1, offsets[0] - startoffset, stdout); -+ -+ /* The use of \K may make the end offset earlier than the start. In -+ this situation, swap them round. */ -+ -+ if (offsets[0] > offsets[1]) -+ { -+ PCRE2_SIZE temp = offsets[0]; -+ offsets[0] = offsets[1]; -+ offsets[1] = temp; -+ } -+ -+ FWRITE_IGNORE(ptr + endprevious, 1, offsets[0] - endprevious, stdout); - print_match(ptr + offsets[0], offsets[1] - offsets[0]); - } - -@@ -2805,8 +2844,8 @@ while (ptr < endptr) - and its line-ending characters (if they matched the pattern), so there - may be no more to print. */ - -- plength = (int)((linelength + endlinelength) - startoffset); -- if (plength > 0) FWRITE_IGNORE(ptr + startoffset, 1, plength, stdout); -+ plength = (int)((linelength + endlinelength) - endprevious); -+ if (plength > 0) FWRITE_IGNORE(ptr + endprevious, 1, plength, stdout); - } - - /* Not colouring or multiline; no need to search for further matches. */ -diff --git a/testdata/grepoutput b/testdata/grepoutput -index 7e963fb..e49c2b2 100644 ---- a/testdata/grepoutput -+++ b/testdata/grepoutput -@@ -936,3 +936,12 @@ end - 16:start end in between start - end - RC=0 -+---------------------------- Test 125 ----------------------------- -+abcd -+RC=0 -+abcd -+RC=0 -+abcd -+RC=0 -+abcd -+RC=0 --- -2.13.6 - diff --git a/pcre2-10.30-Fix-PCRE2_FIRSTLINE-bug-when-a-pattern-match-starts-.patch b/pcre2-10.30-Fix-PCRE2_FIRSTLINE-bug-when-a-pattern-match-starts-.patch deleted file mode 100644 index f91ac0f..0000000 --- a/pcre2-10.30-Fix-PCRE2_FIRSTLINE-bug-when-a-pattern-match-starts-.patch +++ /dev/null @@ -1,206 +0,0 @@ -From f3b22988611cca57770a705f05c0d9ef583d605a Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Mon, 1 Jan 2018 14:12:35 +0000 -Subject: [PATCH] Fix PCRE2_FIRSTLINE bug when a pattern match starts with the - first code unit of a newline sequence. -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@899 6239d852-aaf2-0410-a92c-79f79f948069 -Petr Písař: Ported to 10.32 - -Signed-off-by: Petr Písař ---- - src/pcre2_dfa_match.c | 21 +++++++++++++++------ - src/pcre2_match.c | 19 ++++++++++++++----- - testdata/testinput2 | 10 ++++++++++ - testdata/testinput6 | 10 ++++++++++ - testdata/testoutput2 | 13 +++++++++++++ - testdata/testoutput6 | 13 +++++++++++++ - 6 files changed, 75 insertions(+), 11 deletions(-) - -diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c -index 5ae1394..7bbd6d3 100644 ---- a/src/pcre2_dfa_match.c -+++ b/src/pcre2_dfa_match.c -@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. - - Written by Philip Hazel - Original API code Copyright (c) 1997-2012 University of Cambridge -- New API code Copyright (c) 2016-2017 University of Cambridge -+ New API code Copyright (c) 2016-2018 University of Cambridge - - ----------------------------------------------------------------------------- - Redistribution and use in source and binary forms, with or without -@@ -3558,9 +3558,11 @@ for (;;) - - /* If firstline is TRUE, the start of the match is constrained to the first - line of a multiline string. That is, the match must be before or at the -- first newline. Implement this by temporarily adjusting end_subject so that -- we stop the optimization scans for a first code unit at a newline. If the -- match fails at the newline, later code breaks this loop. */ -+ first newline following the start of matching. Temporarily adjust -+ end_subject so that we stop the optimization scans for a first code unit -+ immediately after the first character of a newline (the first code unit can -+ legitimately be a newline). If the match fails at the newline, later code -+ breaks this loop. */ - - if (firstline) - { -@@ -3568,7 +3570,7 @@ for (;;) - #ifdef SUPPORT_UNICODE - if (utf) - { -- while (t < mb->end_subject && !IS_NEWLINE(t)) -+ while (t < end_subject && !IS_NEWLINE(t)) - { - t++; - ACROSSCHAR(t < end_subject, *t, t++); -@@ -3576,7 +3578,14 @@ for (;;) - } - else - #endif -- while (t < mb->end_subject && !IS_NEWLINE(t)) t++; -+ while (t < end_subject && !IS_NEWLINE(t)) t++; -+ -+ /* Note that we only need to advance by one code unit if we found a -+ newline. If the newline is CRLF, a first code unit of LF should not -+ match, because it is not at or before the newline. Similarly, only the -+ first code unit of a Unicode newline might be relevant. */ -+ -+ if (t < end_subject) t++; - end_subject = t; - } - -diff --git a/src/pcre2_match.c b/src/pcre2_match.c -index 050b7e9..8afb0d8 100644 ---- a/src/pcre2_match.c -+++ b/src/pcre2_match.c -@@ -6541,9 +6541,11 @@ for(;;) - - /* If firstline is TRUE, the start of the match is constrained to the first - line of a multiline string. That is, the match must be before or at the -- first newline. Implement this by temporarily adjusting end_subject so that -- we stop the optimization scans for a first code unit at a newline. If the -- match fails at the newline, later code breaks this loop. */ -+ first newline following the start of matching. Temporarily adjust -+ end_subject so that we stop the optimization scans for a first code unit -+ immediately after the first character of a newline (the first code unit can -+ legitimately be a newline). If the match fails at the newline, later code -+ breaks this loop. */ - - if (firstline) - { -@@ -6551,7 +6553,7 @@ for(;;) - #ifdef SUPPORT_UNICODE - if (utf) - { -- while (t < mb->end_subject && !IS_NEWLINE(t)) -+ while (t < end_subject && !IS_NEWLINE(t)) - { - t++; - ACROSSCHAR(t < end_subject, *t, t++); -@@ -6559,7 +6561,14 @@ for(;;) - } - else - #endif -- while (t < mb->end_subject && !IS_NEWLINE(t)) t++; -+ while (t < end_subject && !IS_NEWLINE(t)) t++; -+ -+ /* Note that we only need to advance by one code unit if we found a -+ newline. If the newline is CRLF, a first code unit of LF should not -+ match, because it is not at or before the newline. Similarly, only the -+ first code unit of a Unicode newline might be relevant. */ -+ -+ if (t < end_subject) t++; - end_subject = t; - } - -diff --git a/testdata/testinput2 b/testdata/testinput2 -index 695f0a4..b173fe0 100644 ---- a/testdata/testinput2 -+++ b/testdata/testinput2 -@@ -5385,4 +5385,14 @@ a)"xI - ab - aaab - -+/\n/firstline -+ xyz\nabc -+ -+/\nabc/firstline -+ xyz\nabc -+ -+/\x{0a}abc/firstline,newline=crlf -+\= Expect no match -+ xyz\r\nabc -+ - # End of testinput2 -diff --git a/testdata/testinput6 b/testdata/testinput6 -index ce2e082..614c3a0 100644 ---- a/testdata/testinput6 -+++ b/testdata/testinput6 -@@ -4932,4 +4932,14 @@ - /(*LIMIT_MATCH=100).*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););/no_dotstar_anchor - .*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?);); - -+/\n/firstline -+ xyz\nabc -+ -+/\nabc/firstline -+ xyz\nabc -+ -+/\x{0a}abc/firstline,newline=crlf -+\= Expect no match -+ xyz\r\nabc -+ - # End of testinput6 -diff --git a/testdata/testoutput2 b/testdata/testoutput2 -index 31ccfbe..c19c270 100644 ---- a/testdata/testoutput2 -+++ b/testdata/testoutput2 -@@ -16368,6 +16368,19 @@ Subject length lower bound = 1 - 0: ab - 1: a - -+/\n/firstline -+ xyz\nabc -+ 0: \x0a -+ -+/\nabc/firstline -+ xyz\nabc -+ 0: \x0aabc -+ -+/\x{0a}abc/firstline,newline=crlf -+\= Expect no match -+ xyz\r\nabc -+No match -+ - # End of testinput2 - Error -65: PCRE2_ERROR_BADDATA (unknown error number) - Error -62: bad serialized data -diff --git a/testdata/testoutput6 b/testdata/testoutput6 -index b912944..2d321d5 100644 ---- a/testdata/testoutput6 -+++ b/testdata/testoutput6 -@@ -7753,4 +7753,17 @@ No match - .*(?![|H]?.*(?![|H]?););.*(?![|H]?.*(?![|H]?););\x00\x00\x00\x00\x00\x00\x00(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?!(?![|);)?.*(![|H]?);)?.*(?![|H]?);)?.*(?![|H]?);)?.*(?![|H]););![|H]?););[|H]?);|H]?);)\x00\x00\x00 \x00\x00\x00H]?););?![|H]?);)?.*(?![|H]?););[||H]?);)?.*(?![|H]?););[|H]?);(?![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?););;[\x00\x00\x00\x00\x00\x00\x00![|H]?););![|H]?););[|H]?);|H]?);)?.*(?![|H]?);); - Failed: error -47: match limit exceeded - -+/\n/firstline -+ xyz\nabc -+ 0: \x0a -+ -+/\nabc/firstline -+ xyz\nabc -+ 0: \x0aabc -+ -+/\x{0a}abc/firstline,newline=crlf -+\= Expect no match -+ xyz\r\nabc -+No match -+ - # End of testinput6 --- -2.13.6 - diff --git a/pcre2-10.30-Fix-incorrect-first-matching-character-when-a-backre.patch b/pcre2-10.30-Fix-incorrect-first-matching-character-when-a-backre.patch deleted file mode 100644 index c4a86ce..0000000 --- a/pcre2-10.30-Fix-incorrect-first-matching-character-when-a-backre.patch +++ /dev/null @@ -1,91 +0,0 @@ -From b5343d4a647d25640e16bfa1f813c39a7f2059a6 Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Tue, 12 Dec 2017 15:01:51 +0000 -Subject: [PATCH] Fix incorrect first matching character when a backreference - with zero minimum repeat starts a pattern (possibly after assertions). -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@888 6239d852-aaf2-0410-a92c-79f79f948069 - -Petr Písař: Ported to 10.30. ---- - src/pcre2_compile.c | 2 +- - testdata/testinput2 | 10 ++++++++++ - testdata/testoutput2 | 28 ++++++++++++++++++++++++++++ - -diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c -index 0b91d14..ad17338 100644 ---- a/src/pcre2_compile.c -+++ b/src/pcre2_compile.c -@@ -7135,7 +7135,7 @@ for (;; pptr++) - later. */ - - HANDLE_SINGLE_REFERENCE: -- if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE; -+ if (firstcuflags == REQ_UNSET) zerofirstcuflags = firstcuflags = REQ_NONE; - *code++ = ((options & PCRE2_CASELESS) != 0)? OP_REFI : OP_REF; - PUT2INC(code, 0, meta_arg); - -diff --git a/testdata/testinput2 b/testdata/testinput2 -index 022df20..695f0a4 100644 ---- a/testdata/testinput2 -+++ b/testdata/testinput2 -@@ -5375,4 +5375,14 @@ a)"xI - - /[\d-[:print:]]/ - -+# Perl gets the second of these wrong, giving no match. -+ -+"(?<=(a))\1?b"I -+ ab -+ aaab -+ -+"(?=(a))\1?b"I -+ ab -+ aaab -+ - # End of testinput2 -diff --git a/testdata/testoutput2 b/testdata/testoutput2 -index 2d9e347..31ccfbe 100644 ---- a/testdata/testoutput2 -+++ b/testdata/testoutput2 -@@ -16340,6 +16340,34 @@ Failed: error 150 at offset 3: invalid range in character class - /[\d-[:print:]]/ - Failed: error 150 at offset 3: invalid range in character class - -+# Perl gets the second of these wrong, giving no match. -+ -+"(?<=(a))\1?b"I -+Capturing subpattern count = 1 -+Max back reference = 1 -+Max lookbehind = 1 -+Last code unit = 'b' -+Subject length lower bound = 1 -+ ab -+ 0: b -+ 1: a -+ aaab -+ 0: ab -+ 1: a -+ -+"(?=(a))\1?b"I -+Capturing subpattern count = 1 -+Max back reference = 1 -+Starting code units: a -+Last code unit = 'b' -+Subject length lower bound = 1 -+ ab -+ 0: ab -+ 1: a -+ aaab -+ 0: ab -+ 1: a -+ - # End of testinput2 - Error -65: PCRE2_ERROR_BADDATA (unknown error number) - Error -62: bad serialized data --- -2.13.6 - diff --git a/pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch b/pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch deleted file mode 100644 index 058b292..0000000 --- a/pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 12dd78fc2ff2d941e724c7af72fa22daa8528041 Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Sun, 22 Oct 2017 16:17:44 +0000 -Subject: [PATCH 2/2] Fix memory leak issue introduced in last bug fix in - pcre2grep. -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@874 6239d852-aaf2-0410-a92c-79f79f948069 -Signed-off-by: Petr Písař ---- - src/pcre2grep.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/pcre2grep.c b/src/pcre2grep.c -index d7410b4..d75917c 100644 ---- a/src/pcre2grep.c -+++ b/src/pcre2grep.c -@@ -3051,7 +3051,8 @@ if (isdirectory(pathname)) - if (fnlength > FNBUFSIZ) - { - fprintf(stderr, "pcre2grep: recursive filename is too long\n"); -- return 2; -+ rc = 2; -+ break; - } - sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile); - frc = grep_or_recurse(buffer, dir_recurse, FALSE); --- -2.13.6 - diff --git a/pcre2-10.30-Fix-multiple-multiline-matching-issues-in-pcre2grep.patch b/pcre2-10.30-Fix-multiple-multiline-matching-issues-in-pcre2grep.patch deleted file mode 100644 index 497a2a8..0000000 --- a/pcre2-10.30-Fix-multiple-multiline-matching-issues-in-pcre2grep.patch +++ /dev/null @@ -1,383 +0,0 @@ -From eff8c9e117259b1192919b85c2ee03a27b164f1a Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Mon, 13 Nov 2017 16:52:39 +0000 -Subject: [PATCH] Fix multiple multiline matching issues in pcre2grep. -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@878 6239d852-aaf2-0410-a92c-79f79f948069 - -Petr Písař: Ported to 10.30. - -diff --git a/RunGrepTest b/RunGrepTest -index cf88c78..a7496cb 100755 ---- a/RunGrepTest -+++ b/RunGrepTest -@@ -248,7 +248,7 @@ echo "---------------------------- Test 35 -----------------------------" >>test - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 36 -----------------------------" >>testtrygrep --(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude=grepinputM --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 37 -----------------------------" >>testtrygrep -@@ -391,6 +391,12 @@ echo "RC=$?" >>testtrygrep - echo "---------------------------- Test 70 -----------------------------" >>testtrygrep - (cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep - echo "RC=$?" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep --color=always -M -n "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep -+echo "RC=$?" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep -+echo "RC=$?" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -M -n "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep -+echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 71 -----------------------------" >>testtrygrep - (cd $srcdir; $valgrind $vjs $pcre2grep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep -@@ -494,25 +500,25 @@ echo "---------------------------- Test 95 -----------------------------" >>test - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 96 -----------------------------" >>testtrygrep --(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' 'fox' ./test* | sort) >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include-dir=testdata --exclude '^(?!grepinput)' --exclude=grepinputM 'fox' ./test* | sort) >>testtrygrep - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 97 -----------------------------" >>testtrygrep - echo "grepinput$" >testtemp1grep - echo "grepinput8" >>testtemp1grep --(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include=grepinput --exclude=grepinputM --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 98 -----------------------------" >>testtrygrep - echo "grepinput$" >testtemp1grep - echo "grepinput8" >>testtemp1grep --(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --exclude=grepinput3 --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --exclude=grepinput3 --exclude=grepinputM --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 99 -----------------------------" >>testtrygrep - echo "grepinput$" >testtemp1grep - echo "grepinput8" >testtemp2grep --(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include grepinput --exclude-from $builddir/testtemp1grep --exclude-from=$builddir/testtemp2grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -L -r --include grepinput --exclude=grepinputM --exclude-from $builddir/testtemp1grep --exclude-from=$builddir/testtemp2grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 100 ------------------------------" >>testtrygrep -@@ -582,7 +588,7 @@ echo "---------------------------- Test 115 -----------------------------" >>tes - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 116 -----------------------------" >>testtrygrep --(cd $srcdir; $valgrind $vjs $pcre2grep -th 'the' testdata/grepinput*) >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep --exclude=grepinputM -th 'the' testdata/grepinput*) >>testtrygrep - echo "RC=$?" >>testtrygrep - - echo "---------------------------- Test 117 -----------------------------" >>testtrygrep -@@ -610,10 +616,20 @@ echo "---------------------------- Test 122 -----------------------------" >>tes - (cd $srcdir; $valgrind $vjs $pcre2grep -w 'cat|dog' testdata/grepinputv) >>testtrygrep - echo "RC=$?" >>testtrygrep - --echo "---------------------------- Test 122 -----------------------------" >>testtrygrep -+echo "---------------------------- Test 123 -----------------------------" >>testtrygrep - (cd $srcdir; $valgrind $vjs $pcre2grep -w 'dog|cat' testdata/grepinputv) >>testtrygrep - echo "RC=$?" >>testtrygrep - -+echo "---------------------------- Test 124 -----------------------------" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -Mn --colour=always 'start[\s]+end' testdata/grepinputM) >>testtrygrep -+echo "RC=$?" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -Mn --colour=always -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep -+echo "RC=$?" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -Mn 'start[\s]+end' testdata/grepinputM) >>testtrygrep -+echo "RC=$?" >>testtrygrep -+(cd $srcdir; $valgrind $vjs $pcre2grep -Mn -A2 'start[\s]+end' testdata/grepinputM) >>testtrygrep -+echo "RC=$?" >>testtrygrep -+ - - # Now compare the results. - -diff --git a/src/pcre2grep.c b/src/pcre2grep.c -index 1649d5a..bec07e1 100644 ---- a/src/pcre2grep.c -+++ b/src/pcre2grep.c -@@ -2505,7 +2505,10 @@ while (ptr < endptr) - match = match_patterns(ptr, length, options, startoffset, &mrc); - options = PCRE2_NOTEMPTY; - -- /* If it's a match or a not-match (as required), do what's wanted. */ -+ /* If it's a match or a not-match (as required), do what's wanted. NOTE: Use -+ only FWRITE_IGNORE() - which is just a packaged fwrite() that ignores its -+ return code - to output data lines, so that binary zeroes are treated as just -+ another data character. */ - - if (match != invert) - { -@@ -2734,27 +2737,6 @@ while (ptr < endptr) - if (printname != NULL) fprintf(stdout, "%s:", printname); - if (number) fprintf(stdout, "%d:", linenumber); - -- /* In multiline mode, we want to print to the end of the line in which -- the end of the matched string is found, so we adjust linelength and the -- line number appropriately, but only when there actually was a match -- (invert not set). Because the PCRE2_FIRSTLINE option is set, the start of -- the match will always be before the first newline sequence. */ -- -- if (multiline & !invert) -- { -- char *endmatch = ptr + offsets[1]; -- t = ptr; -- while (t <= endmatch) -- { -- t = end_of_line(t, endptr, &endlinelength); -- if (t < endmatch) linenumber++; else break; -- } -- linelength = t - ptr - endlinelength; -- } -- -- /*** NOTE: Use only fwrite() to output the data line, so that binary -- zeroes are treated as just another data character. */ -- - /* This extra option, for Jeffrey Friedl's debugging requirements, - replaces the matched string, or a specific captured string if it exists, - with X. When this happens, colouring is ignored. */ -@@ -2771,20 +2753,48 @@ while (ptr < endptr) - else - #endif - -- /* We have to split the line(s) up if colouring, and search for further -- matches, but not of course if the line is a non-match. */ -+ /* In multiline mode, or if colouring, we have to split the line(s) up -+ and search for further matches, but not of course if the line is a -+ non-match. In multiline mode this is necessary in case there is another -+ match that spans the end of the current line. When colouring we want to -+ colour all matches. */ - -- if (do_colour && !invert) -+ if ((multiline || do_colour) && !invert) - { - int plength; - FWRITE_IGNORE(ptr, 1, offsets[0], stdout); - print_match(ptr + offsets[0], offsets[1] - offsets[0]); - for (;;) - { -- startoffset = offsets[1]; -- if (startoffset >= linelength + endlinelength || -- !match_patterns(ptr, length, options, startoffset, &mrc)) -- break; -+ startoffset = offsets[1]; /* Advance after previous match. */ -+ -+ /* If the current match ended past the end of the line (only possible -+ in multiline mode), we must move on to the line in which it did end -+ before searching for more matches. Because the PCRE2_FIRSTLINE option -+ is set, the start of the match will always be before the first -+ newline sequence. */ -+ -+ while (startoffset > linelength + endlinelength) -+ { -+ ptr += linelength + endlinelength; -+ filepos += (int)(linelength + endlinelength); -+ linenumber++; -+ startoffset -= (int)(linelength + endlinelength); -+ t = end_of_line(ptr, endptr, &endlinelength); -+ linelength = t - ptr - endlinelength; -+ length = (size_t)(endptr - ptr); -+ } -+ -+ /* If startoffset is at the exact end of the line it means this -+ complete line was the final part of the match, so there is nothing -+ more to do. */ -+ -+ if (startoffset == linelength + endlinelength) break; -+ -+ /* Otherwise, run a match from within the final line, and if found, -+ loop for any that may follow. */ -+ -+ if (!match_patterns(ptr, length, options, startoffset, &mrc)) break; - FWRITE_IGNORE(ptr + startoffset, 1, offsets[0] - startoffset, stdout); - print_match(ptr + offsets[0], offsets[1] - offsets[0]); - } -@@ -2797,7 +2807,7 @@ while (ptr < endptr) - if (plength > 0) FWRITE_IGNORE(ptr + startoffset, 1, plength, stdout); - } - -- /* Not colouring; no need to search for further matches */ -+ /* Not colouring or multiline; no need to search for further matches. */ - - else FWRITE_IGNORE(ptr, 1, linelength + endlinelength, stdout); - } -diff --git a/testdata/grepinputM b/testdata/grepinputM -new file mode 100644 -index 0000000..9119e3d ---- /dev/null -+++ b/testdata/grepinputM -@@ -0,0 +1,17 @@ -+Data file for multiline tests of multiple matches. -+ -+start end in between start -+end and following -+Other stuff -+ -+start end in between start -+end and following start -+end other stuff -+ -+start end in between start -+ -+end -+ -+** These two lines must be last. -+start end in between start -+end -diff --git a/testdata/grepoutput b/testdata/grepoutput -index 52e0d17..7e963fb 100644 ---- a/testdata/grepoutput -+++ b/testdata/grepoutput -@@ -487,6 +487,7 @@ RC=0 - ./testdata/grepinput:456 - ./testdata/grepinput3:0 - ./testdata/grepinput8:0 -+./testdata/grepinputM:0 - ./testdata/grepinputv:1 - ./testdata/grepinputx:0 - RC=0 -@@ -600,6 +601,33 @@ RC=0 - triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt - - RC=0 -+1:triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt -+ -+6:triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt -+ -+8:triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt -+ -+13:triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt -+ -+RC=0 -+triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt -+ -+triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt -+ -+triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt -+ -+triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt -+ -+RC=0 -+1:triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt -+ -+6:triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt -+ -+8:triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt -+ -+13:triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt -+ -+RC=0 - ---------------------------- Test 71 ----------------------------- - 01 - RC=0 -@@ -793,21 +821,23 @@ RC=0 - 37216,12 - RC=0 - ---------------------------- Test 113 ----------------------------- --478 -+480 - RC=0 - ---------------------------- Test 114 ----------------------------- - testdata/grepinput:469 - testdata/grepinput3:0 - testdata/grepinput8:0 -+testdata/grepinputM:2 - testdata/grepinputv:3 - testdata/grepinputx:6 --TOTAL:478 -+TOTAL:480 - RC=0 - ---------------------------- Test 115 ----------------------------- - testdata/grepinput:469 -+testdata/grepinputM:2 - testdata/grepinputv:3 - testdata/grepinputx:6 --TOTAL:478 -+TOTAL:480 - RC=0 - ---------------------------- Test 116 ----------------------------- - 478 -@@ -816,9 +846,10 @@ RC=0 - 469 - 0 - 0 -+2 - 3 - 6 --478 -+480 - RC=0 - ---------------------------- Test 118 ----------------------------- - testdata/grepinput3 -@@ -846,7 +877,62 @@ RC=0 - over the lazy dog. - The word is cat in this line - RC=0 ------------------------------ Test 122 ----------------------------- -+---------------------------- Test 123 ----------------------------- - over the lazy dog. - The word is cat in this line - RC=0 -+---------------------------- Test 124 ----------------------------- -+3:start end in between start -+end and following -+7:start end in between start -+end and following start -+end other stuff -+11:start end in between start -+ -+end -+16:start end in between start -+end -+RC=0 -+3:start end in between start -+end and following -+5-Other stuff -+6- -+7:start end in between start -+end and following start -+end other stuff -+10- -+11:start end in between start -+ -+end -+14- -+15-** These two lines must be last. -+16:start end in between start -+end -+RC=0 -+3:start end in between start -+end and following -+7:start end in between start -+end and following start -+end other stuff -+11:start end in between start -+ -+end -+16:start end in between start -+end -+RC=0 -+3:start end in between start -+end and following -+5-Other stuff -+6- -+7:start end in between start -+end and following start -+end other stuff -+10- -+11:start end in between start -+ -+end -+14- -+15-** These two lines must be last. -+16:start end in between start -+end -+RC=0 --- -2.13.6 - diff --git a/pcre2-10.30-Fix-pcre2_jit_match-early-check.patch b/pcre2-10.30-Fix-pcre2_jit_match-early-check.patch deleted file mode 100644 index 7f7b1a6..0000000 --- a/pcre2-10.30-Fix-pcre2_jit_match-early-check.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 67aa24cc00470222301cb5fe3c53bc319105d092 Mon Sep 17 00:00:00 2001 -From: zherczeg -Date: Thu, 23 Nov 2017 07:54:39 +0000 -Subject: [PATCH] Fix pcre2_jit_match early check. -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@884 6239d852-aaf2-0410-a92c-79f79f948069 - -Petr Písař: Ported to 10.30. - -diff --git a/src/pcre2_jit_match.c b/src/pcre2_jit_match.c -index 4cad754..2f840ab 100644 ---- a/src/pcre2_jit_match.c -+++ b/src/pcre2_jit_match.c -@@ -118,7 +118,7 @@ if ((options & PCRE2_PARTIAL_HARD) != 0) - else if ((options & PCRE2_PARTIAL_SOFT) != 0) - index = 1; - --if (functions->executable_funcs[index] == NULL) -+if (functions->executable_funcs == NULL || functions->executable_funcs[index] == NULL) - return PCRE2_ERROR_JIT_BADOPTION; - - /* Sanity checks should be handled by pcre_exec. */ --- -2.13.6 - diff --git a/pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch b/pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch deleted file mode 100644 index 874938c..0000000 --- a/pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 386fd5ed13bd694a9940365602be6fcefd52d295 Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Fri, 20 Oct 2017 16:51:59 +0000 -Subject: [PATCH 1/2] Fix pcre2grep recursive file name length issue. -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@873 6239d852-aaf2-0410-a92c-79f79f948069 - -Petr Písař: Ported to 10.30. - -diff --git a/src/pcre2grep.c b/src/pcre2grep.c -index bd86998..d7410b4 100644 ---- a/src/pcre2grep.c -+++ b/src/pcre2grep.c -@@ -109,7 +109,7 @@ typedef int BOOL; - #define MAXPATLEN 8192 - #endif - --#define FNBUFSIZ 1024 -+#define FNBUFSIZ 2048 - #define ERRBUFSIZ 256 - - /* Values for the "filenames" variable, which specifies options for file name -@@ -3032,7 +3032,7 @@ if (isdirectory(pathname)) - - if (dee_action == dee_RECURSE) - { -- char buffer[1024]; -+ char buffer[FNBUFSIZ]; - char *nextfile; - directory_type *dir = opendirectory(pathname); - -@@ -3047,7 +3047,13 @@ if (isdirectory(pathname)) - while ((nextfile = readdirectory(dir)) != NULL) - { - int frc; -- sprintf(buffer, "%.512s%c%.128s", pathname, FILESEP, nextfile); -+ int fnlength = strlen(pathname) + strlen(nextfile) + 2; -+ if (fnlength > FNBUFSIZ) -+ { -+ fprintf(stderr, "pcre2grep: recursive filename is too long\n"); -+ return 2; -+ } -+ sprintf(buffer, "%s%c%s", pathname, FILESEP, nextfile); - frc = grep_or_recurse(buffer, dir_recurse, FALSE); - if (frc > 1) rc = frc; - else if (frc == 0 && rc == 1) rc = 0; --- -2.13.6 - diff --git a/pcre2-10.30-Previous-FIRSTLINE-patch-was-broken.-Fix-it.patch b/pcre2-10.30-Previous-FIRSTLINE-patch-was-broken.-Fix-it.patch deleted file mode 100644 index dac25bd..0000000 --- a/pcre2-10.30-Previous-FIRSTLINE-patch-was-broken.-Fix-it.patch +++ /dev/null @@ -1,218 +0,0 @@ -From 1b5d77c6edc5ee8e8fe5c96bf9cad5798d6ce36c Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Mon, 1 Jan 2018 14:54:06 +0000 -Subject: [PATCH 3/3] Previous FIRSTLINE patch was broken. Fix it. -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@900 6239d852-aaf2-0410-a92c-79f79f948069 -Signed-off-by: Petr Písař ---- - src/pcre2_dfa_match.c | 27 +++++++++++---------------- - src/pcre2_match.c | 37 +++++++++++++++---------------------- - testdata/testinput2 | 4 ++++ - testdata/testinput6 | 4 ++++ - testdata/testoutput2 | 5 +++++ - testdata/testoutput6 | 5 +++++ - 6 files changed, 44 insertions(+), 38 deletions(-) - -diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c -index 9c1d805..65243bf 100644 ---- a/src/pcre2_dfa_match.c -+++ b/src/pcre2_dfa_match.c -@@ -3363,8 +3363,6 @@ for (;;) - if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0 && - (options & PCRE2_DFA_RESTART) == 0) - { -- PCRE2_SPTR save_end_subject = end_subject; -- - /* If firstline is TRUE, the start of the match is constrained to the first - line of a multiline string. That is, the match must be before or at the - first newline following the start of matching. Temporarily adjust -@@ -3388,13 +3386,6 @@ for (;;) - else - #endif - while (t < end_subject && !IS_NEWLINE(t)) t++; -- -- /* Note that we only need to advance by one code unit if we found a -- newline. If the newline is CRLF, a first code unit of LF should not -- match, because it is not at or before the newline. Similarly, only the -- first code unit of a Unicode newline might be relevant. */ -- -- if (t < end_subject) t++; - end_subject = t; - } - -@@ -3466,14 +3457,18 @@ for (;;) - #endif - } - -- /* If we can't find the required code unit, break the bumpalong loop, -- to force a match failure, except when doing partial matching, when we -- let the next cycle run at the end of the subject. To see why, consider -- the pattern /(?<=abc)def/, which partially matches "abc", even though -- the string does not contain the starting character "d". */ -+ /* If we can't find the required code unit, having reached the true end -+ of the subject, break the bumpalong loop, to force a match failure, -+ except when doing partial matching, when we let the next cycle run at -+ the end of the subject. To see why, consider the pattern /(?<=abc)def/, -+ which partially matches "abc", even though the string does not contain -+ the starting character "d". If we have not reached the true end of the -+ subject (PCRE2_FIRSTLINE caused end_subject to be temporarily modified) -+ we also let the cycle run, because the matching string is legitimately -+ allowed to start with the first code unit of a newline. */ - - if ((mb->moptions & (PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT)) == 0 && -- start_match >= end_subject) -+ start_match >= mb->end_subject) - break; - } - -@@ -3532,7 +3527,7 @@ for (;;) - - /* Restore fudged end_subject */ - -- end_subject = save_end_subject; -+ end_subject = mb->end_subject; - - /* The following two optimizations are disabled for partial matching. */ - -diff --git a/src/pcre2_match.c b/src/pcre2_match.c -index 8872345..c6b6975 100644 ---- a/src/pcre2_match.c -+++ b/src/pcre2_match.c -@@ -7,7 +7,7 @@ and semantics are as close as possible to those of the Perl 5 language. - - Written by Philip Hazel - Original API code Copyright (c) 1997-2012 University of Cambridge -- New API code Copyright (c) 2015-2017 University of Cambridge -+ New API code Copyright (c) 2015-2018 University of Cambridge - - ----------------------------------------------------------------------------- - Redistribution and use in source and binary forms, with or without -@@ -6363,15 +6363,11 @@ for(;;) - - if ((re->overall_options & PCRE2_NO_START_OPTIMIZE) == 0) - { -- PCRE2_SPTR save_end_subject = end_subject; -- - /* If firstline is TRUE, the start of the match is constrained to the first - line of a multiline string. That is, the match must be before or at the - first newline following the start of matching. Temporarily adjust -- end_subject so that we stop the optimization scans for a first code unit -- immediately after the first character of a newline (the first code unit can -- legitimately be a newline). If the match fails at the newline, later code -- breaks this loop. */ -+ end_subject so that we stop the scans for a first code unit at a newline. -+ If the match fails at the newline, later code breaks the loop. */ - - if (firstline) - { -@@ -6388,13 +6384,6 @@ for(;;) - else - #endif - while (t < end_subject && !IS_NEWLINE(t)) t++; -- -- /* Note that we only need to advance by one code unit if we found a -- newline. If the newline is CRLF, a first code unit of LF should not -- match, because it is not at or before the newline. Similarly, only the -- first code unit of a Unicode newline might be relevant. */ -- -- if (t < end_subject) t++; - end_subject = t; - } - -@@ -6470,13 +6459,17 @@ for(;;) - #endif - } - -- /* If we can't find the required code unit, break the bumpalong loop, -- to force a match failure, except when doing partial matching, when we -- let the next cycle run at the end of the subject. To see why, consider -- the pattern /(?<=abc)def/, which partially matches "abc", even though -- the string does not contain the starting character "d". */ -- -- if (!mb->partial && start_match >= end_subject) -+ /* If we can't find the required code unit, having reached the true end -+ of the subject, break the bumpalong loop, to force a match failure, -+ except when doing partial matching, when we let the next cycle run at -+ the end of the subject. To see why, consider the pattern /(?<=abc)def/, -+ which partially matches "abc", even though the string does not contain -+ the starting character "d". If we have not reached the true end of the -+ subject (PCRE2_FIRSTLINE caused end_subject to be temporarily modified) -+ we also let the cycle run, because the matching string is legitimately -+ allowed to start with the first code unit of a newline. */ -+ -+ if (!mb->partial && start_match >= mb->end_subject) - { - rc = MATCH_NOMATCH; - break; -@@ -6538,7 +6531,7 @@ for(;;) - - /* Restore fudged end_subject */ - -- end_subject = save_end_subject; -+ end_subject = mb->end_subject; - - /* The following two optimizations must be disabled for partial matching. */ - -diff --git a/testdata/testinput2 b/testdata/testinput2 -index fe8efbf..36e4454 100644 ---- a/testdata/testinput2 -+++ b/testdata/testinput2 -@@ -5405,4 +5405,8 @@ a)"xI - \= Expect no match - xyz\r\nabc - -+/[abc]/firstline -+\= Expect no match -+ \na -+ - # End of testinput2 -diff --git a/testdata/testinput6 b/testdata/testinput6 -index 614c3a0..e2f00c0 100644 ---- a/testdata/testinput6 -+++ b/testdata/testinput6 -@@ -4942,4 +4942,8 @@ - \= Expect no match - xyz\r\nabc - -+/[abc]/firstline -+\= Expect no match -+ \na -+ - # End of testinput6 -diff --git a/testdata/testoutput2 b/testdata/testoutput2 -index 62ec12f..f146c0c 100644 ---- a/testdata/testoutput2 -+++ b/testdata/testoutput2 -@@ -16453,6 +16453,11 @@ No match - xyz\r\nabc - No match - -+/[abc]/firstline -+\= Expect no match -+ \na -+No match -+ - # End of testinput2 - Error -65: PCRE2_ERROR_BADDATA (unknown error number) - Error -62: bad serialized data -diff --git a/testdata/testoutput6 b/testdata/testoutput6 -index 998f20b..b409fe0 100644 ---- a/testdata/testoutput6 -+++ b/testdata/testoutput6 -@@ -7766,4 +7766,9 @@ Failed: error -47: match limit exceeded - xyz\r\nabc - No match - -+/[abc]/firstline -+\= Expect no match -+ \na -+No match -+ - # End of testinput6 --- -2.13.6 - diff --git a/pcre2-10.30-Remove-superflous-variable.patch b/pcre2-10.30-Remove-superflous-variable.patch deleted file mode 100644 index 3070e85..0000000 --- a/pcre2-10.30-Remove-superflous-variable.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 5e964db12e04a84c9b74751d5c22ae4ff4bb416c Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Thu, 9 Nov 2017 17:50:59 +0000 -Subject: [PATCH] Remove superflous variable. -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@877 6239d852-aaf2-0410-a92c-79f79f948069 -Signed-off-by: Petr Písař ---- - src/pcre2grep.c | 21 ++++++++++----------- - 1 file changed, 10 insertions(+), 11 deletions(-) - -diff --git a/src/pcre2grep.c b/src/pcre2grep.c -index d75917c..1649d5a 100644 ---- a/src/pcre2grep.c -+++ b/src/pcre2grep.c -@@ -2365,7 +2365,6 @@ while (ptr < endptr) - int mrc = 0; - unsigned int options = 0; - BOOL match; -- char *matchptr = ptr; - char *t = ptr; - size_t length, linelength; - size_t startoffset = 0; -@@ -2503,7 +2502,7 @@ while (ptr < endptr) - match, set PCRE2_NOTEMPTY to disable any further matches of null strings in - this line. */ - -- match = match_patterns(matchptr, length, options, startoffset, &mrc); -+ match = match_patterns(ptr, length, options, startoffset, &mrc); - options = PCRE2_NOTEMPTY; - - /* If it's a match or a not-match (as required), do what's wanted. */ -@@ -2564,14 +2563,14 @@ while (ptr < endptr) - /* Handle --line-offsets */ - - if (line_offsets) -- fprintf(stdout, "%d,%d" STDOUT_NL, (int)(matchptr + offsets[0] - ptr), -+ fprintf(stdout, "%d,%d" STDOUT_NL, (int)(ptr + offsets[0] - ptr), - (int)(offsets[1] - offsets[0])); - - /* Handle --file-offsets */ - - else if (file_offsets) - fprintf(stdout, "%d,%d" STDOUT_NL, -- (int)(filepos + matchptr + offsets[0] - ptr), -+ (int)(filepos + ptr + offsets[0] - ptr), - (int)(offsets[1] - offsets[0])); - - /* Handle --output (which has already been syntax checked) */ -@@ -2579,7 +2578,7 @@ while (ptr < endptr) - else if (output_text != NULL) - { - if (display_output_text((PCRE2_SPTR)output_text, FALSE, -- (PCRE2_SPTR)matchptr, offsets, mrc) || printname != NULL || -+ (PCRE2_SPTR)ptr, offsets, mrc) || printname != NULL || - number) - fprintf(stdout, STDOUT_NL); - } -@@ -2601,7 +2600,7 @@ while (ptr < endptr) - { - if (printed && om_separator != NULL) - fprintf(stdout, "%s", om_separator); -- print_match(matchptr + offsets[n*2], plen); -+ print_match(ptr + offsets[n*2], plen); - printed = TRUE; - } - } -@@ -2628,7 +2627,7 @@ while (ptr < endptr) - { - if (startoffset >= length) goto END_ONE_MATCH; /* Were at end */ - startoffset = oldstartoffset + 1; -- if (utf) while ((matchptr[startoffset] & 0xc0) == 0x80) startoffset++; -+ if (utf) while ((ptr[startoffset] & 0xc0) == 0x80) startoffset++; - } - - /* If the current match ended past the end of the line (only possible -@@ -2637,7 +2636,7 @@ while (ptr < endptr) - - while (startoffset > linelength) - { -- matchptr = ptr += linelength + endlinelength; -+ ptr += linelength + endlinelength; - filepos += (int)(linelength + endlinelength); - linenumber++; - startoffset -= (int)(linelength + endlinelength); -@@ -2784,10 +2783,10 @@ while (ptr < endptr) - { - startoffset = offsets[1]; - if (startoffset >= linelength + endlinelength || -- !match_patterns(matchptr, length, options, startoffset, &mrc)) -+ !match_patterns(ptr, length, options, startoffset, &mrc)) - break; -- FWRITE_IGNORE(matchptr + startoffset, 1, offsets[0] - startoffset, stdout); -- print_match(matchptr + offsets[0], offsets[1] - offsets[0]); -+ FWRITE_IGNORE(ptr + startoffset, 1, offsets[0] - startoffset, stdout); -+ print_match(ptr + offsets[0], offsets[1] - offsets[0]); - } - - /* In multiline mode, we may have already printed the complete line --- -2.13.6 - diff --git a/pcre2-10.30-Update-pcre2demo-to-deal-with-various-K-inside-asser.patch b/pcre2-10.30-Update-pcre2demo-to-deal-with-various-K-inside-asser.patch deleted file mode 100644 index 4dcdec6..0000000 --- a/pcre2-10.30-Update-pcre2demo-to-deal-with-various-K-inside-asser.patch +++ /dev/null @@ -1,96 +0,0 @@ -From f442210323e228a407dfda75b6bb7a62e91111ee Mon Sep 17 00:00:00 2001 -From: ph10 -Date: Sat, 23 Dec 2017 17:15:51 +0000 -Subject: [PATCH 1/3] Update pcre2demo to deal with various \K inside assertion - anomalies. -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@894 6239d852-aaf2-0410-a92c-79f79f948069 - -Petr Písař: Ported to 10.30. ---- - src/pcre2demo.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - -diff --git a/src/pcre2demo.c b/src/pcre2demo.c -index 8ae49f1..5d9b321 100644 ---- a/src/pcre2demo.c -+++ b/src/pcre2demo.c -@@ -211,6 +211,21 @@ pcre2_match_data_create_from_pattern() above. */ - if (rc == 0) - printf("ovector was not big enough for all the captured substrings\n"); - -+/* We must guard against patterns such as /(?=.\K)/ that use \K in an assertion -+to set the start of a match later than its end. In this demonstration program, -+we just detect this case and give up. */ -+ -+if (ovector[0] > ovector[1]) -+ { -+ printf("\\K was used in an assertion to set the match start after its end.\n" -+ "From end to start the match was: %.*s\n", (int)(ovector[0] - ovector[1]), -+ (char *)(subject + ovector[1])); -+ printf("Run abandoned\n"); -+ pcre2_match_data_free(match_data); -+ pcre2_code_free(re); -+ return 1; -+ } -+ - /* Show substrings stored in the output vector by number. Obviously, in a real - application you might want to do things other than print them. */ - -@@ -338,6 +353,29 @@ for (;;) - options = PCRE2_NOTEMPTY_ATSTART | PCRE2_ANCHORED; - } - -+ /* If the previous match was not an empty string, there is one tricky case to -+ consider. If a pattern contains \K within a lookbehind assertion at the -+ start, the end of the matched string can be at the offset where the match -+ started. Without special action, this leads to a loop that keeps on matching -+ the same substring. We must detect this case and arrange to move the start on -+ by one character. The pcre2_get_startchar() function returns the starting -+ offset that was passed to pcre2_match(). */ -+ -+ else -+ { -+ PCRE2_SIZE startchar = pcre2_get_startchar(match_data); -+ if (start_offset <= startchar) -+ { -+ if (startchar >= subject_length) break; /* Reached end of subject. */ -+ start_offset = startchar + 1; /* Advance by one character. */ -+ if (utf8) /* If UTF-8, it may be more */ -+ { /* than one code unit. */ -+ for (; start_offset < subject_length; start_offset++) -+ if ((subject[start_offset] & 0xc0) != 0x80) break; -+ } -+ } -+ } -+ - /* Run the next matching operation */ - - rc = pcre2_match( -@@ -402,6 +440,21 @@ for (;;) - if (rc == 0) - printf("ovector was not big enough for all the captured substrings\n"); - -+ /* We must guard against patterns such as /(?=.\K)/ that use \K in an -+ assertion to set the start of a match later than its end. In this -+ demonstration program, we just detect this case and give up. */ -+ -+ if (ovector[0] > ovector[1]) -+ { -+ printf("\\K was used in an assertion to set the match start after its end.\n" -+ "From end to start the match was: %.*s\n", (int)(ovector[0] - ovector[1]), -+ (char *)(subject + ovector[1])); -+ printf("Run abandoned\n"); -+ pcre2_match_data_free(match_data); -+ pcre2_code_free(re); -+ return 1; -+ } -+ - /* As before, show substrings stored in the output vector by number, and then - also any named substrings. */ - --- -2.13.6 - diff --git a/pcre2.spec b/pcre2.spec index 1fb0fa5..11ab77e 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -1,12 +1,15 @@ +# Add readline edditing in pcre2test tool +%bcond_without pcre2_enables_readline + # Disable SELinux-frindly JIT allocator because it seems not to be fork-safe, # https://bugs.exim.org/show_bug.cgi?id=1749#c45 -%{bcond_with pcre2_enables_sealloc} +%bcond_with pcre2_enables_sealloc # This is stable release: -#%%global rcversion RC1 +%global rcversion RC1 Name: pcre2 -Version: 10.30 -Release: %{?rcversion:0.}5%{?rcversion:.%rcversion}%{?dist} +Version: 10.31 +Release: %{?rcversion:0.}1%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -17,23 +20,26 @@ Summary: Perl-compatible regular expression library # for testdata #Bundled # src/sljit: BSD -#Not distributed in binary package +#Not distributed in any binary package # aclocal.m4: FSFULLR and GPLv2+ with exception # ar-lib: GPLv2+ with exception # autotools: GPLv3+ with exception +# cmake/COPYING-CMAKE-SCRIPTS: BSD # compile: GPLv2+ with exception # config.sub: GPLv3+ with exception +# configure: FSFUL and GPLv2+ with exception # depcomp: GPLv2+ with exception # install-sh: MIT -# ltmain.sh: GPLv2+ with exception and GPLv3+ with -# exception and GPLv3+ +# ltmain.sh: GPLv2+ with exception and (MIT or GPLv3+) # m4/ax_pthread.m4: GPLv3+ with exception -# m4/libtool.m4: FSFULLR and GPLv2+ with exception +# m4/libtool.m4: FSFUL and FSFULLR and +# GPLv2+ with exception # m4/ltoptions.m4: FSFULLR # m4/ltsugar.m4: FSFULLR # m4/ltversion.m4: FSFULLR # m4/lt~obsolete.m4: FSFULLR # m4/pcre2_visibility.m4: FSFULLR +# Makefile.in: FSFULLR # missing: GPLv2+ with exception # test-driver: GPLv2+ with exception # testdata: Public Domain @@ -42,44 +48,6 @@ URL: http://www.pcre.org/ Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{?rcversion:Testing/}%{name}-%{myversion}.tar.bz2 # Do no set RPATH if libdir is not /usr/lib Patch0: pcre2-10.10-Fix-multilib.patch -# 1/2 Accept files names longer than 128 bytes in recursive mode of pcre2grep, -# upstream bug #2177, in upstream after 10.30 -Patch1: pcre2-10.30-Fix-pcre2grep-recursive-file-name-length-issue.patch -# 2/2 Accept files names longer than 128 bytes in recursive mode of pcre2grep, -# upstream bug #2177, in upstream after 10.30 -Patch2: pcre2-10.30-Fix-memory-leak-issue-introduced-in-last-bug-fix-in-.patch -# Required for Fix-multiple-multiline-matching-issues-in-pcre2grep.patch -Patch3: pcre2-10.30-Remove-superflous-variable.patch -# Fix multi-line matching in pcre2grep tool, upstream bug #2187, -# in upstream after 10.30 -Patch4: pcre2-10.30-Fix-multiple-multiline-matching-issues-in-pcre2grep.patch -# Fix pcre2_jit_match() to properly check the pattern was JIT-compiled, -# in upstream after 10.30 -Patch5: pcre2-10.30-Fix-pcre2_jit_match-early-check.patch -# Allow pcre2grep match counter to handle values larger than 2147483647, -# upstream bug #2208, in upstream after 10.30 -Patch6: pcre2-10.30-Change-pcre2grep-line-number-and-count-variables-to-.patch -# Fix incorrect first matching character when a backreference with zero minimum -# repeat starts a pattern, upstream bug #2209, in upstream after 10.30 -Patch7: pcre2-10.30-Fix-incorrect-first-matching-character-when-a-backre.patch -# 1/2 Fix handling \K in an assertion in documentation, upstream bug #2211, -# in upstream after 10.30 -Patch8: pcre2-10.30-Update-pcre2demo-to-deal-with-various-K-inside-asser.patch -# 2/2 Fix handling \K in an assertion in documentation, upstream bug #2211, -# upstream bug #2211, in upstream after 10.30 -Patch9: pcre2-10.30-Documentation-update.patch -# Fix handling \K in an assertion in pcre2grep tool, upstream bug #2211, -# in upstream after 10.30 -Patch10: pcre2-10.30-Fix-K-issues-in-pcre2grep.patch -# 1/3 Fix matching at a first code unit of a new line sequence if -# PCRE2_FIRSTLINE is enabled, in upstream after 10.30 -Patch11: pcre2-10.30-FIRSTLINE_documentation-update.patch -# 2/3 Fix matching at a first code unit of a new line sequence if -# PCRE2_FIRSTLINE is enabled, in upstream after 10.30 -Patch12: pcre2-10.30-Fix-PCRE2_FIRSTLINE-bug-when-a-pattern-match-starts-.patch -# 3/3 Fix matching at a first code unit of a new line sequence if -# PCRE2_FIRSTLINE is enabled, in upstream after 10.30 -Patch13: pcre2-10.30-Previous-FIRSTLINE-patch-was-broken.-Fix-it.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -154,19 +122,6 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test. %prep %setup -q -n %{name}-%{myversion} %patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch4 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 # Because of multilib patch libtoolize --copy --force autoreconf -vif @@ -203,7 +158,11 @@ autoreconf -vif --disable-pcre2grep-libbz2 \ --disable-pcre2grep-libz \ --disable-pcre2test-libedit \ +%if %{with pcre2_enables_readline} --enable-pcre2test-libreadline \ +%else + --disable-pcre2test-libreadline \ +%endif --disable-rebuild-chartables \ --enable-shared \ --disable-silent-rules \ @@ -270,6 +229,9 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Mon Jan 15 2018 Petr Pisar - 10.31-0.1.RC1 +- 10.31-RC1 bump + * Fri Jan 12 2018 Petr Pisar - 10.30-5 - Fix handling \K in an assertion in pcre2grep tool and documentation (upstream bug #2211) diff --git a/sources b/sources index 2c9967a..b1ba1c2 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (pcre2-10.30.tar.bz2) = f247a9f917c75920793b9919a45bb1426d126246e7a5d04e39d9407e44b5781f894a90cd3d232b385436b2f22be391335ab782664dd3a28c79058a2fcc74dc3e +SHA512 (pcre2-10.31-RC1.tar.bz2) = 1eef755c775575fdea1f3d90590affb1363265995197c04f5b82b3e0f9e9f79aa7e82689815c3e3a4a7673f76be2b00cf9dc9a399ce008baeb76d08a9aa3b50f