Commit Graph

50 Commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belón 7db8784296
pcre2grep: correctly handle multiple passes (#35)
* tests: use a explicit filehandle to share in testing -m

The way stdin is shared to all participants of a subshell varies
per shell, and at least the standard /bin/sh in Solaris seem to
create a new copy for each command, defeating the purpose of the
test.

Use instead exec to create a filehandle that could then be used
explicitly in the test to confirm that the stream is set.

* pcre2grep: correctly handle multiple passes

When the -m option is used, pcre2grep is meant to exit after enough
matches are found but while leaving the stream pinned to the next position
after the last match.

Unfortunately, it wasn't tracking correctly the beginning of the stream
on subsequent passes, and therefore it will fail to use the right seek
value.

Grab the position of the stream at the beginning and while at it, make
sure that the stream passed hasn't been consumed already.
2021-11-09 16:57:48 +00:00
Philip Hazel 31a46200fa Add --allow-lookaround-bsk to pcre2grep 2021-08-31 16:24:25 +01:00
Philip.Hazel 25029849c3 Fix RunGrepTest's handling of binary zeros on Solaris by using /usr/xpg4/bin/tr
instead of tr if /usr/xpg4/bin/tr exists.
2021-02-07 16:43:00 +00:00
Philip.Hazel 027c9375c0 Update RunGrepTest to use tr for handling binary zeros instead of sed, which it
is hoped with increase portability. Bugzilla #2681.
2021-01-04 17:17:48 +00:00
Philip.Hazel 7eb23f423e Final file tidies for 10.36 2020-12-04 14:30:03 +00:00
Philip.Hazel 000bbf2ea7 File tidies for 10.36-RC1 2020-11-06 17:27:35 +00:00
Philip.Hazel 92554d19aa Fix binary zero issue (Bugzilla #2628) in RunGrepTest. 2020-10-09 15:25:27 +00:00
Philip.Hazel 81da2b97e3 pcre2grep update: -m and $x{..}, $o{..} escapes. Also some doc updates. 2020-10-04 16:34:31 +00:00
Philip.Hazel 9e960f5465 Ensure a newline after the final line in a file is output by pcre2grep. 2020-01-25 15:50:44 +00:00
Philip.Hazel ae9208ab7b Source tidies (trailing spaces) etc. for 10.34-RC1. 2019-10-17 16:39:38 +00:00
Philip.Hazel 90ae0ae01e Fix minor test issues and tidies/updates for 10.34-RC1 testing release. 2019-10-15 15:23:31 +00:00
Philip.Hazel 0d1ab8515f Fix pcre2grep -o bug when ovector overflows; add option to adjust the limit;
raise the default limit; give error if -o requests an uncaptured parens.
2019-06-15 15:51:07 +00:00
Philip.Hazel 4f31de2866 Add support for invalid UTF-8 matching to pcre2grep. 2019-05-28 14:14:22 +00:00
Philip.Hazel 7375089fa5 More file tidies for 10.33-RC1 2019-03-04 18:07:04 +00:00
Philip.Hazel 0448b486e9 Redirect stderr in RunGrepTest instead of appending to testtrygrep from two
different file descriptors, because the latter doesn't always work as expected.
2018-12-06 17:13:41 +00:00
Philip.Hazel 8f1727af98 Cut out test of NUL characters in RunGrepTest for all OS except Linux, as it
doesn't work for *BSD as well as for Solaris and MacOS (which were already cut 
out).
2018-12-06 17:05:06 +00:00
Philip.Hazel 0ad7ff1549 Add --disable-pcre2grep-callout-fork configuration setting. 2018-11-17 16:45:57 +00:00
Philip.Hazel 392974a0cb File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
Philip.Hazel 9d87fcb727 Patches for portability. 2018-06-20 17:05:31 +00:00
Philip.Hazel fabea723cf Typos in documentation and comments noted by Jason Hood. 2018-06-17 14:13:28 +00:00
Philip.Hazel 04919e9d03 Add support to pcre2grep for binary zeros in -f files. 2018-02-24 17:09:19 +00:00
Philip.Hazel 911d43cd1e Fix \K issues in pcre2grep. 2017-12-26 15:10:04 +00:00
Philip.Hazel 76814d92c7 Fix multiple multiline matching issues in pcre2grep. 2017-11-13 16:52:39 +00:00
Philip.Hazel 72716c1f21 Fudge binary zero pcre2grep test for Darwin, similar to SunOS. 2017-08-18 15:21:08 +00:00
Philip.Hazel e3052af6fd Cut out the binary zero pcre2grep test on Solaris (SunOS) as it isn't possible
to check the output because sed won't handle binary zeros on Solaris.
2017-07-18 17:22:39 +00:00
Philip.Hazel 76a57bd839 Convert pcre2grep to use new pcre2_compile() options, thereby fixing two minor
(?) bugs.
2017-06-17 11:32:06 +00:00
Philip.Hazel 3d80fa4fc2 Implement PCRE2_NEWLINE_NUL. 2017-05-26 17:14:36 +00:00
Philip.Hazel 88abc14e42 Jason Hood's pcre2grep patches (modified a bit) to add --output to pcre2grep,
and also an inbuilt callout echo.
2017-04-06 18:02:40 +00:00
Philip.Hazel 36973c012b Fix new test (119) for running in non-source directly. 2017-02-12 13:54:45 +00:00
Philip.Hazel 0299bba9d9 Fix previously broken fix for pcre2grep with -Mo matching strings that cross
line boundaries.
2017-02-10 17:39:29 +00:00
Philip.Hazel b5f105054c Ensure user colour settings are turned off for pcre2grep testing. 2016-12-31 17:46:40 +00:00
Philip.Hazel 664cc446bb Fix typos; unset GREP_COLO[U]R. 2016-12-29 15:57:38 +00:00
Philip.Hazel 1828179ef9 Add -t to pcre2grep. 2016-10-16 16:48:14 +00:00
Philip.Hazel bf6f0bb335 Implement buffer expansion in pcre2grep. 2016-10-11 16:40:09 +00:00
Philip.Hazel 921636f6fc Documentation detrail and make HTML for 10.22-RC1. 2016-06-29 16:52:05 +00:00
Philip.Hazel b002f44061 Fix bad interaction between -o and -M in pcre2grep. 2016-06-17 17:37:26 +00:00
Philip.Hazel 784b3d2409 Update valgrind parameters in RunGrepTest and arrange for the suppressions file
to be used when JIT is supported.
2016-05-31 11:36:10 +00:00
Philip.Hazel c332eaf4f2 Add callout support to pcre2grep 2016-04-01 15:52:08 +00:00
Philip.Hazel dffd559601 File tidies, version updates, etc. for 10.21-RC1 2015-12-17 18:44:06 +00:00
Philip.Hazel bb68c64c40 Implement #newline_default and adjust testdata and scripts to use it. 2015-09-08 17:01:17 +00:00
Philip.Hazel 537f8b1a3d Make -q override -l and -q in pcre2grep for compatibility with other greps. 2015-08-05 17:35:36 +00:00
Philip.Hazel ba8f1d8002 Maintenance on test after running ManyConfigTests. 2015-05-17 17:44:21 +00:00
Philip.Hazel cda8384a95 Fix pcre2grep loop provoked by \K in a lookbehind assertion in a non-anchored
pattern.
2015-04-03 11:14:19 +00:00
Philip.Hazel 08e3107cbe Changed jit_stack_alloc to jit_stack_create. 2014-11-03 17:13:00 +00:00
Philip.Hazel 8aa511a98b Improve test coverage; minor typo in JIT test and other minor buglets fixed. 2014-10-31 12:34:34 +00:00
Philip.Hazel c3799e750f Tidy a lot of files (remove trailing spaces) 2014-10-20 17:28:49 +00:00
Philip.Hazel eb59159ce0 Change --enable-pcre8 etc to --enable-pcre2-8 etc and consequent changes;
change "pcre" to "pcre2" in a number of files.
2014-10-17 15:52:57 +00:00
Philip.Hazel 81525e6007 Some typos 2014-09-26 09:44:49 +00:00
Philip.Hazel babec83424 Check for pcre2grep's existence before testing; clean up all temporary files
afterwards.
2014-08-29 15:24:33 +00:00
Philip.Hazel 7854bf34b3 Implement pcre2grep and its test. 2014-07-15 08:46:12 +00:00