From 12804f64cf4bde53878c707e886033dfb77dcb6d427502da30052aa3402d0819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= Date: Thu, 15 Apr 2021 14:24:36 +0000 Subject: [PATCH] Accepting request 885301 from home:jengelh:branches:devel:libraries:c_c++ Revert r48 and instate pcre2-symbol-clash.patch OBS-URL: https://build.opensuse.org/request/show/885301 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/pcre2?expand=0&rev=49 --- pcre2-symbol-clash.patch | 44 ++++++++++++++++++++++++++++++++++++++++ pcre2.changes | 8 +++----- pcre2.spec | 32 ++++++----------------------- 3 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 pcre2-symbol-clash.patch diff --git a/pcre2-symbol-clash.patch b/pcre2-symbol-clash.patch new file mode 100644 index 0000000..6af1e14 --- /dev/null +++ b/pcre2-symbol-clash.patch @@ -0,0 +1,44 @@ +From: Jan Engelhardt +Date: 2021-04-14 11:42:14.750408048 + +If libpcre2-posix.so makes it into a process image somehow before +libc.so (which is easy: gcc something.c -lpcre2-posix), pcre2's +"regcomp" symbol wins a race over libc's "regcomp" symbol. There are +likely more situations as well, because libc's "regcomp" is _also_ +marked as weak. Anyway, because the functions two are not +behavior-compatible, problems arise. + +To stay ABI compatible, we could make a new library without regcomp etc., +and edit the .pc file to point to the new library, but that would not +capture the case someone uses plain gcc -l without pkg-config. + +Since regcomp is "#defined" to pcre2_regcomp, any programs that were +source-compiled are fine. Removing the reg* symbols from the library +hence only breaks the case of dlsym(libpcre2-posix, "regcomp"), +which, I will argue, is an absolute niche use of the PCRE libraries +and something we are willing to break. + +--- + src/pcre2posix.c | 2 ++ + 1 file changed, 2 insertions(+) + +Index: pcre2-10.36/src/pcre2posix.c +=================================================================== +--- pcre2-10.36.orig/src/pcre2posix.c ++++ pcre2-10.36/src/pcre2posix.c +@@ -185,6 +185,7 @@ This also ensures that the POSIX names a + include pcre2posix.h. It is vital to #undef the macro definitions from + pcre2posix.h! */ + ++#if 0 + #undef regerror + PCRE2POSIX_EXP_DECL size_t regerror(int, const regex_t *, char *, size_t); + PCRE2POSIX_EXP_DEFN size_t PCRE2_CALL_CONVENTION +@@ -218,6 +219,7 @@ regexec(const regex_t *preg, const char + { + return pcre2_regexec(preg, string, nmatch, pmatch, eflags); + } ++#endif + + + diff --git a/pcre2.changes b/pcre2.changes index cd684e5..1b8bf58 100644 --- a/pcre2.changes +++ b/pcre2.changes @@ -1,10 +1,8 @@ ------------------------------------------------------------------- -Fri Apr 2 13:34:41 UTC 2021 - Cristian Rodríguez +Wed Apr 14 09:57:53 UTC 2021 - Jan Engelhardt -- libpcre2-posix exports symbols that conflict with libc, so it - should not be pulled by pcre-devel only by applications that - explicitly BuildRequires: pkgconfig(libpcre-posix2) , split a - libpcre2-posix-devel package. +- Remove regcomp, regexec etc. from libpcre2-posix. + (Add pcre2-symbol-clash.patch) ------------------------------------------------------------------- Sat Dec 5 12:41:55 UTC 2020 - Andreas Stieger diff --git a/pcre2.spec b/pcre2.spec index 55b55a2..83bfba9 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -31,6 +31,7 @@ Source3: %{name}.keyring Source4: baselibs.conf #PATCH-FIX-OPENSUSE tchvatal@suse.cz upstream thinks it is good idea to use rpath, taken from RH Patch1: pcre2-10.10-multilib.patch +Patch2: pcre2-symbol-clash.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc-c++ @@ -54,6 +55,7 @@ Group: Development/Libraries/C and C++ Requires: libpcre2-16-0 = %{version} Requires: libpcre2-32-0 = %{version} Requires: libpcre2-8-0 = %{version} +Requires: libpcre2-posix2 = %{version} Requires: libstdc++-devel %description devel @@ -136,20 +138,6 @@ API. pcre2-posix provides a POSIX-compatible API to the PCRE2 engine. -%package -n libpcre2-posix-devel -Summary: A library for Perl-compatible regular expressions -Group: Development/Libraries/C and C++ -Requires: libpcre2-posix2 = %{version} -Provides: %{_includedir}/pcre2posix.h - -%description -n libpcre2-posix-devel -The PCRE2 library is a set of functions that implement regular -expression pattern matching using the same syntax and semantics -as Perl 5. - -PCRE2 is a re-working of the original PCRE library to provide an entirely new -API. - %package doc Summary: A library for Perl-compatible regular expressions Group: Documentation/HTML @@ -177,8 +165,7 @@ PCRE2 is a re-working of the original PCRE library to provide an entirely new API. %prep -%setup -q -%patch1 -p1 +%autosetup -p1 %build %define _lto_cflags %{nil} @@ -249,12 +236,6 @@ export LANG=POSIX %license LICENCE %{_libdir}/libpcre2-posix.so.* -%files -n libpcre2-posix-devel -%license LICENCE -%{_libdir}/pkgconfig/libpcre2-posix.pc -%{_libdir}/libpcre2-posix.so -%{_includedir}/pcre2posix.h - %files tools %license LICENCE %{_bindir}/pcre2grep @@ -271,13 +252,12 @@ export LANG=POSIX %files devel %license LICENCE %{_bindir}/pcre2-config -%{_includedir}/pcre2.h -%{_libdir}/libpcre2-16.so -%{_libdir}/libpcre2-32.so -%{_libdir}/libpcre2-8.so +%{_includedir}/* +%{_libdir}/*.so %{_libdir}/pkgconfig/libpcre2-8.pc %{_libdir}/pkgconfig/libpcre2-16.pc %{_libdir}/pkgconfig/libpcre2-32.pc +%{_libdir}/pkgconfig/libpcre2-posix.pc %{_mandir}/man1/pcre2-config.1%{?ext_man} %{_mandir}/man3/*%{ext_man}