Remove real POSIX function names from the pcre2-posix library.

This commit is contained in:
Philip.Hazel 2021-04-27 08:36:47 +00:00
parent 38dbea6200
commit 080d7789eb
5 changed files with 88 additions and 56 deletions

View File

@ -11,13 +11,13 @@ with binary zeros. This is from Bugzilla #2681. Patch from Jeremie
Courreges-Anglas via Nam Nguyen. This fixes RunGrepTest for OpenBSD. Later:
it broke it for at least one version of Solaris, where tr can't handle binary
zeros. However, that system had /usr/xpg4/bin/tr installed, which works OK, so
RunGrepTest now checks for that command and use it if found.
RunGrepTest now checks for that command and uses it if found.
2. Compiling with gcc 10.2's -fanalyzer option showed up a hypothetical problem
with a NULL dereference. I don't think this case could ever occur in practice,
but I have put in a check in order to get rid of the compiler error.
3. An alternative patch for CMakeLists.txt because 10.36 # 4 breaks CMake on
3. An alternative patch for CMakeLists.txt because 10.36 #4 breaks CMake on
Windows. Patch from email@cs-ware.de fixes bugzilla #2688.
4. Two bugs related to over-large numbers have been fixed so the behaviour is
@ -44,6 +44,14 @@ recursions such as /(a\K.(?1)*)/ did not have this problem.
7. Restore single character repetition optimization in JIT. Currently fewer
character repetitions are optimized than in 10.34.
8. When the names of the functions in the POSIX wrapper were changed to
pcre2_regcomp() etc. (see change 10.33 #4 below), functions with the original
names were left in the library so that pre-compiled programs would still work.
However, this has proved troublesome when programs link with several libraries,
some of which use PCRE2 via the POSIX interface while others use a native POSIX
library. For this reason, the POSIX function names are removed in this release.
The macros in pcre2posix.h should ensure that re-compiling fixes any programs
that haven't been compiled since before 10.33.
Version 10.36 04-December-2020

View File

@ -68,11 +68,14 @@ application. Because the POSIX functions call the native ones, it is also
necessary to add <b>-lpcre2-8</b>.
</P>
<P>
Although they are not defined as protypes in <b>pcre2posix.h</b>, the library
does contain functions with the POSIX names <b>regcomp()</b> etc. These simply
pass their arguments to the PCRE2 functions. These functions are provided for
backwards compatibility with earlier versions of PCRE2, so that existing
programs do not have to be recompiled.
Although they were not defined as protypes in <b>pcre2posix.h</b>, releases
10.33 to 10.36 of the library contained functions with the POSIX names
<b>regcomp()</b> etc. These simply passed their arguments to the PCRE2
functions. These functions were provided for backwards compatibility with
earlier versions of PCRE2, which had only POSIX names. However, this has proved
troublesome in situations where a program links with several libraries, some of
which use PCRE2's POSIX interface while others use the real POSIX functions.
For this reason, the POSIX names have been removed since release 10.37.
</P>
<P>
Calling the header file <b>pcre2posix.h</b> avoids any conflict with other POSIX
@ -344,9 +347,9 @@ Cambridge, England.
</P>
<br><a name="SEC10" href="#TOC1">REVISION</a><br>
<P>
Last updated: 30 January 2019
Last updated: 26 April 2021
<br>
Copyright &copy; 1997-2019 University of Cambridge.
Copyright &copy; 1997-2021 University of Cambridge.
<br>
<p>
Return to the <a href="index.html">PCRE2 index page</a>.

View File

@ -180,8 +180,8 @@ REVISION
Last updated: 17 September 2018
Copyright (c) 1997-2018 University of Cambridge.
------------------------------------------------------------------------------
PCRE2API(3) Library Functions Manual PCRE2API(3)
@ -3829,8 +3829,8 @@ REVISION
Last updated: 04 November 2020
Copyright (c) 1997-2020 University of Cambridge.
------------------------------------------------------------------------------
PCRE2BUILD(3) Library Functions Manual PCRE2BUILD(3)
@ -4423,8 +4423,8 @@ REVISION
Last updated: 20 March 2020
Copyright (c) 1997-2020 University of Cambridge.
------------------------------------------------------------------------------
PCRE2CALLOUT(3) Library Functions Manual PCRE2CALLOUT(3)
@ -4853,8 +4853,8 @@ REVISION
Last updated: 03 February 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2COMPAT(3) Library Functions Manual PCRE2COMPAT(3)
@ -5066,8 +5066,8 @@ REVISION
Last updated: 06 October 2020
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2JIT(3) Library Functions Manual PCRE2JIT(3)
@ -5491,8 +5491,8 @@ REVISION
Last updated: 23 May 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2LIMITS(3) Library Functions Manual PCRE2LIMITS(3)
@ -5561,8 +5561,8 @@ REVISION
Last updated: 02 February 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2MATCHING(3) Library Functions Manual PCRE2MATCHING(3)
@ -5785,8 +5785,8 @@ REVISION
Last updated: 23 May 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2PARTIAL(3) Library Functions Manual PCRE2PARTIAL(3)
@ -6165,8 +6165,8 @@ REVISION
Last updated: 04 September 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2PATTERN(3) Library Functions Manual PCRE2PATTERN(3)
@ -9613,8 +9613,8 @@ REVISION
Last updated: 06 October 2020
Copyright (c) 1997-2020 University of Cambridge.
------------------------------------------------------------------------------
PCRE2PERFORM(3) Library Functions Manual PCRE2PERFORM(3)
@ -9848,8 +9848,8 @@ REVISION
Last updated: 03 February 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2POSIX(3) Library Functions Manual PCRE2POSIX(3)
@ -9895,11 +9895,15 @@ DESCRIPTION
an application. Because the POSIX functions call the native ones, it is
also necessary to add -lpcre2-8.
Although they are not defined as protypes in pcre2posix.h, the library
does contain functions with the POSIX names regcomp() etc. These simply
pass their arguments to the PCRE2 functions. These functions are pro-
vided for backwards compatibility with earlier versions of PCRE2, so
that existing programs do not have to be recompiled.
Although they were not defined as protypes in pcre2posix.h, releases
10.33 to 10.36 of the library contained functions with the POSIX names
regcomp() etc. These simply passed their arguments to the PCRE2 func-
tions. These functions were provided for backwards compatibility with
earlier versions of PCRE2, which had only POSIX names. However, this
has proved troublesome in situations where a program links with several
libraries, some of which use PCRE2's POSIX interface while others use
the real POSIX functions. For this reason, the POSIX names have been
removed since release 10.37.
Calling the header file pcre2posix.h avoids any conflict with other
POSIX libraries. It can, of course, be renamed or aliased as regex.h,
@ -10175,11 +10179,11 @@ AUTHOR
REVISION
Last updated: 30 January 2019
Copyright (c) 1997-2019 University of Cambridge.
Last updated: 26 April 2021
Copyright (c) 1997-2021 University of Cambridge.
------------------------------------------------------------------------------
PCRE2SAMPLE(3) Library Functions Manual PCRE2SAMPLE(3)
@ -10457,8 +10461,8 @@ REVISION
Last updated: 27 June 2018
Copyright (c) 1997-2018 University of Cambridge.
------------------------------------------------------------------------------
PCRE2SYNTAX(3) Library Functions Manual PCRE2SYNTAX(3)
@ -10973,8 +10977,8 @@ REVISION
Last updated: 28 December 2019
Copyright (c) 1997-2019 University of Cambridge.
------------------------------------------------------------------------------
PCRE2UNICODE(3) Library Functions Manual PCRE2UNICODE(3)
@ -11408,5 +11412,5 @@ REVISION
Last updated: 23 February 2020
Copyright (c) 1997-2020 University of Cambridge.
------------------------------------------------------------------------------

View File

@ -1,4 +1,4 @@
.TH PCRE2POSIX 3 "30 January 2019" "PCRE2 10.33"
.TH PCRE2POSIX 3 "26 April 2021" "PCRE2 10.37"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH "SYNOPSIS"
@ -44,11 +44,14 @@ can be accessed by adding \fB-lpcre2-posix\fP to the command for linking an
application. Because the POSIX functions call the native ones, it is also
necessary to add \fB-lpcre2-8\fP.
.P
Although they are not defined as protypes in \fBpcre2posix.h\fP, the library
does contain functions with the POSIX names \fBregcomp()\fP etc. These simply
pass their arguments to the PCRE2 functions. These functions are provided for
backwards compatibility with earlier versions of PCRE2, so that existing
programs do not have to be recompiled.
Although they were not defined as protypes in \fBpcre2posix.h\fP, releases
10.33 to 10.36 of the library contained functions with the POSIX names
\fBregcomp()\fP etc. These simply passed their arguments to the PCRE2
functions. These functions were provided for backwards compatibility with
earlier versions of PCRE2, which had only POSIX names. However, this has proved
troublesome in situations where a program links with several libraries, some of
which use PCRE2's POSIX interface while others use the real POSIX functions.
For this reason, the POSIX names have been removed since release 10.37.
.P
Calling the header file \fBpcre2posix.h\fP avoids any conflict with other POSIX
libraries. It can, of course, be renamed or aliased as \fBregex.h\fP, which is
@ -321,6 +324,6 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 30 January 2019
Copyright (c) 1997-2019 University of Cambridge.
Last updated: 26 April 2021
Copyright (c) 1997-2021 University of Cambridge.
.fi

View File

@ -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-2019 University of Cambridge
New API code Copyright (c) 2016-2021 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@ -175,6 +175,20 @@ static const char *const pstring[] = {
#if 0 /* REMOVE THIS CODE */
The code below was created for 10.33 (see ChangeLog 10.33 #4) when the
POSIX functions were given pcre2_... names instead of the traditional POSIX
names. However, it has proved to be more troublesome than useful. There have
been at least two cases where a program links with two others, one of which
uses the POSIX library and the other uses the PCRE2 POSIX functions, thus
causing two instances of the POSIX runctions to exist, leading to trouble. For
10.37 this code is commented out. In due course it can be removed if there are
no issues. The only small worry is the comment below about languages that do
not include pcre2posix.h. If there are any such cases, they will have to use
the PCRE2 names.
/*************************************************
* Wrappers with traditional POSIX names *
*************************************************/
@ -218,7 +232,7 @@ regexec(const regex_t *preg, const char *string, size_t nmatch,
{
return pcre2_regexec(preg, string, nmatch, pmatch, eflags);
}
#endif
/*************************************************