Commit Graph

1356 Commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belón dae475092d
pcre2grep: avoid portability minefield with buffered fseek(stdin) (#36)
To allow pcre2grep to do an early exit in a resumable way, -m uses
fseek on stdin, which is sadly not supported in several platforms.

Most of the conflicting issues come from the fact that managing the
position while buffering is not trivial, and is therefore an optional
feature[1] of POSIX.1-2017

Workaround this by removing the buffer to stdin, if the -m option is
being used.  There is likely not a significant performance benefit
even for the platforms that support it, but it could be conditionally
added in that case, later.

Fixes: #10

[1] https://pubs.opengroup.org/onlinepubs/9699919799/functions/fseek.html
2021-11-09 17:15:38 +00:00
Philip Hazel 1ed34b9cb1 Update version to 10.40-RC1 and fix consequent version test issue. 2021-11-09 17:12:50 +00:00
Philip Hazel f19e84674e Update ChangeLog for GitHub #35 fix. 2021-11-09 17:12:13 +00:00
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 072717a61f Fix very minor typos in documentation: redundant spaces. 2021-10-30 11:25:12 +01:00
Philip Hazel 35fee4193b Final file tidies for 10.39. 2021-10-29 17:09:37 +01:00
Philip Hazel 3469b13b8e Update docs and version info for 10.39. 2021-10-29 17:03:31 +01:00
Philip Hazel 29c37f9aa3 Update ChangeLog for GitHub #32 patch. 2021-10-29 16:13:30 +01:00
Carlo Marcelo Arenas Belón 128c50360c
fix building on ancient compilers (#32)
* jit: allow building with ancient MSVC versions

Visual Studio older than 2013, fails to build with JIT enabled,
because it is unable to parse non C89 compatible syntax, with
mixed declarations and code.

While most recent compilers wouldn't even report this as a warning
since it is valid C99, it could be also made visible by adding to
gcc/clang the -Wdeclaration-after-statement flag at build time.

Move the code below the affected definitions.

* pcre2grep: avoid mixing declarations with code

Since d5a61ee8 (Patch to detect (and ignore) symlink loops in
pcre2grep., 2021-08-28), code will fail to build in a strict C89
compiler.

Reformat slightly to make it C89 compatible again.
2021-10-29 16:07:53 +01:00
Philip Hazel bf2c8cc564 Update ChangeLog for GitHub commits and generate HTML docs. 2021-10-29 15:12:56 +01:00
Philip Hazel 87f32b9b39 Add ChangeLog item for GitHub #29. 2021-10-29 15:07:03 +01:00
Philip Hazel 7ed39af7cc Create ChangeLog item for issue #28 merge. 2021-10-29 15:07:03 +01:00
Carlo Marcelo Arenas Belón 3b973ebf4b
inttypes and stdint cleanup (#30)
* cleanup: remove references to no longer used stdint.h

Since 19c50b9d (Unconditionally use inttypes.h instead of trying for
stdint.h (simplification) and remove the now unnecessary inclusion in
pcre2_internal.h., 2018-11-14), stdint.h is no longer used.

Remove checks for it in autotools and CMake and document better the
expected build failures for systems that might have stdint.h (C99)
and not inttypes.h (from POSIX), like old Windows.

* cleanup: remove detection for inttypes.h which is a hard dependency

CMake checks for standard headers are not meant to be used for hard
dependencies, so will prevent a possible fallback to work.

Alternatively, the header could be checked to make the configuration
fail instead of breaking the build, but that was punted, as it was
missing anyway from autotools.
2021-10-29 15:05:19 +01:00
Carlo Marcelo Arenas Belón f5e4e10042
Update to Unicode 14.0.0 (#29) 2021-10-29 14:44:17 +01:00
Carlo Marcelo Arenas Belón d46f1863be
improve on 'auto' mode for DISABLE_PERCENT_ZT (#28)
Visual Studio 2013 includes support for %zu and %td, so let newer
versions of it avoid the fallback, and while at it, make sure that
the first check is for DISABLE_PERCENT_ZT so it will be always
honoured if chosen.

prtdiff_t is signed, so use a signed type instead, and make sure
that an appropiate width is chosen if pointers are 64bit wide.

Remove the need for the size_t cast and instead change the size
of the equivalent format identifier to avoid truncations.
2021-10-29 14:29:47 +01:00
Philip Hazel c99f0738c5 Documentation minor text fixes. 2021-10-29 12:33:20 +01:00
Philip Hazel 794470b51d Merge branch 'master' of github.com:PhilipHazel/pcre2
Documentation update.
2021-10-18 17:10:47 +01:00
PhilipHazel 179c5d212c
Merge pull request #27 from ltrzesniewski/fix-convert-doc
Fix option name in pcre2convert docs
2021-10-18 17:07:18 +01:00
Lucas Trzesniewski ec0755b829 Fix option name in pcre2convert docs 2021-10-17 19:29:44 +02:00
Philip Hazel 8d9e91228c Update version number to 10.39-RC1. 2021-10-06 12:00:04 +01:00
PhilipHazel e7af7efaa1
Merge pull request #22 from PhilipHazel/early_fail_fix
Fix incorrect detection of alternatives in first character search.
2021-10-06 11:55:58 +01:00
Zoltan Herczeg 51ec2c9893 Fix incorrect detection of alternatives in first character search. 2021-10-05 16:41:13 +00:00
Philip Hazel 0612ed77c2 Update dates and tidy files for 10.38 release. 2021-10-01 16:44:09 +01:00
Philip Hazel 507e4dcf6f Fix incorrect loop counter reset when setting lookbehind lengths (ClusterFuzz
38653).
2021-09-14 16:10:20 +01:00
Zoltan Herczeg dc5f966635 Re-enable an optimization which was unintentionally disabled in 10.35. 2021-09-10 10:00:47 +00:00
Philip Hazel 8f3e11a355 Doc file tidies for 10.38-RC1 2021-08-31 17:14:42 +01:00
Philip Hazel e2fde18833 Prepare for 10.38-RC1 release 2021-08-31 17:10:37 +01:00
Philip Hazel 857ac92372 Minor documentation update 2021-08-31 16:25:40 +01:00
Philip Hazel 31a46200fa Add --allow-lookaround-bsk to pcre2grep 2021-08-31 16:24:25 +01:00
Philip Hazel edcc076bd8 Add test files to .gitignore 2021-08-31 15:58:52 +01:00
Philip Hazel c232286c6b Update HTML docs. 2021-08-30 16:59:34 +01:00
Philip Hazel 21c26698b3 Lock out \K in lookaround assertions by default, but provide an option to
re-enable the old behaviour, just in case.
2021-08-30 16:57:44 +01:00
Philip Hazel eea410b33a Improve code for "starts with" optimization in the interpreters. 2021-08-29 17:25:59 +01:00
Philip Hazel d5a61ee891 Patch to detect (and ignore) symlink loops in pcre2grep. 2021-08-28 17:37:33 +01:00
Philip Hazel 6c2fe9da99 Documentation update to clarify ovector usage with DFA matching. 2021-08-28 16:25:59 +01:00
Philip Hazel 5ff1daffa0 Clarify delimiter handling in pcre2test documentation. 2021-08-28 12:46:50 +01:00
Philip Hazel f4beac6c1a Update minimum CMake version to 3.0.0. 2021-08-28 12:11:27 +01:00
Philip Hazel e1cd61c292 Update README.md to be identical to index.md. 2021-08-28 10:19:40 +01:00
Philip Hazel 6ee9921a89 Another tweak needed. 2021-08-28 10:16:41 +01:00
Philip Hazel b8c60ce272 Try another URL format (all one line) for github.io. 2021-08-28 10:12:41 +01:00
Philip Hazel b61aa572f6 Updated all the URLs to better Markdown format. 2021-08-28 10:09:50 +01:00
Philip Hazel 25bb9de6fc Adjust wording for proper link - first test. 2021-08-28 09:56:42 +01:00
Philip Hazel e74a9b6932 We need both README.md and index.md (identical). 2021-08-28 09:47:59 +01:00
PhilipHazel 30036e670f
Rename README.md to index.md 2021-08-28 09:45:29 +01:00
Philip Hazel a8c4ef7f20 Another doc tidy. 2021-08-27 12:23:40 +01:00
Philip Hazel c2fc6cfa0a Revert "Remove dist-bzip2 from AM_INIT_AUTOMAKE in configure.ac because GitHub does not"
This reverts commit 5c0d38b3a8.

I misunderstood GitHub.
2021-08-27 12:06:07 +01:00
Philip Hazel 587e46b372 Ajust so that URLs show as live links. 2021-08-27 09:45:57 +01:00
Philip Hazel d8267c20fd Create README.md as a mini-overview of PCRE2. 2021-08-27 09:32:34 +01:00
Philip Hazel 15b692fd82 Fix typo. 2021-08-27 09:14:11 +01:00
Philip Hazel 4ccef1697a Update HTML docs with new URLs etc. 2021-08-26 17:26:16 +01:00