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: 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 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 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 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, 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. 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. 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 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 7. Restore single character repetition optimization in JIT. Currently fewer
character repetitions are optimized than in 10.34. 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 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>. necessary to add <b>-lpcre2-8</b>.
</P> </P>
<P> <P>
Although they are not defined as protypes in <b>pcre2posix.h</b>, the library Although they were not defined as protypes in <b>pcre2posix.h</b>, releases
does contain functions with the POSIX names <b>regcomp()</b> etc. These simply 10.33 to 10.36 of the library contained functions with the POSIX names
pass their arguments to the PCRE2 functions. These functions are provided for <b>regcomp()</b> etc. These simply passed their arguments to the PCRE2
backwards compatibility with earlier versions of PCRE2, so that existing functions. These functions were provided for backwards compatibility with
programs do not have to be recompiled. 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>
<P> <P>
Calling the header file <b>pcre2posix.h</b> avoids any conflict with other POSIX Calling the header file <b>pcre2posix.h</b> avoids any conflict with other POSIX
@ -344,9 +347,9 @@ Cambridge, England.
</P> </P>
<br><a name="SEC10" href="#TOC1">REVISION</a><br> <br><a name="SEC10" href="#TOC1">REVISION</a><br>
<P> <P>
Last updated: 30 January 2019 Last updated: 26 April 2021
<br> <br>
Copyright &copy; 1997-2019 University of Cambridge. Copyright &copy; 1997-2021 University of Cambridge.
<br> <br>
<p> <p>
Return to the <a href="index.html">PCRE2 index page</a>. Return to the <a href="index.html">PCRE2 index page</a>.

View File

@ -9895,11 +9895,15 @@ DESCRIPTION
an application. Because the POSIX functions call the native ones, it is an application. Because the POSIX functions call the native ones, it is
also necessary to add -lpcre2-8. also necessary to add -lpcre2-8.
Although they are not defined as protypes in pcre2posix.h, the library Although they were not defined as protypes in pcre2posix.h, releases
does contain functions with the POSIX names regcomp() etc. These simply 10.33 to 10.36 of the library contained functions with the POSIX names
pass their arguments to the PCRE2 functions. These functions are pro- regcomp() etc. These simply passed their arguments to the PCRE2 func-
vided for backwards compatibility with earlier versions of PCRE2, so tions. These functions were provided for backwards compatibility with
that existing programs do not have to be recompiled. 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 Calling the header file pcre2posix.h avoids any conflict with other
POSIX libraries. It can, of course, be renamed or aliased as regex.h, POSIX libraries. It can, of course, be renamed or aliased as regex.h,
@ -10175,8 +10179,8 @@ AUTHOR
REVISION REVISION
Last updated: 30 January 2019 Last updated: 26 April 2021
Copyright (c) 1997-2019 University of Cambridge. Copyright (c) 1997-2021 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 .SH NAME
PCRE2 - Perl-compatible regular expressions (revised API) PCRE2 - Perl-compatible regular expressions (revised API)
.SH "SYNOPSIS" .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 application. Because the POSIX functions call the native ones, it is also
necessary to add \fB-lpcre2-8\fP. necessary to add \fB-lpcre2-8\fP.
.P .P
Although they are not defined as protypes in \fBpcre2posix.h\fP, the library Although they were not defined as protypes in \fBpcre2posix.h\fP, releases
does contain functions with the POSIX names \fBregcomp()\fP etc. These simply 10.33 to 10.36 of the library contained functions with the POSIX names
pass their arguments to the PCRE2 functions. These functions are provided for \fBregcomp()\fP etc. These simply passed their arguments to the PCRE2
backwards compatibility with earlier versions of PCRE2, so that existing functions. These functions were provided for backwards compatibility with
programs do not have to be recompiled. 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 \fBpcre2posix.h\fP avoids any conflict with other POSIX 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 libraries. It can, of course, be renamed or aliased as \fBregex.h\fP, which is
@ -321,6 +324,6 @@ Cambridge, England.
.rs .rs
.sp .sp
.nf .nf
Last updated: 30 January 2019 Last updated: 26 April 2021
Copyright (c) 1997-2019 University of Cambridge. Copyright (c) 1997-2021 University of Cambridge.
.fi .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 Written by Philip Hazel
Original API code Copyright (c) 1997-2012 University of Cambridge 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 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 * * 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); return pcre2_regexec(preg, string, nmatch, pmatch, eflags);
} }
#endif
/************************************************* /*************************************************