Hello community, here is the log from the commit of package php7-gmagick for openSUSE:Factory checked in at 2020-01-04 19:22:04 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/php7-gmagick (Old) and /work/SRC/openSUSE:Factory/.php7-gmagick.new.6675 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "php7-gmagick" Sat Jan 4 19:22:04 2020 rev:8 rq:760807 version:2.0.5RC1 Changes: -------- --- /work/SRC/openSUSE:Factory/php7-gmagick/php7-gmagick.changes 2019-12-29 15:50:21.051194113 +0100 +++ /work/SRC/openSUSE:Factory/.php7-gmagick.new.6675/php7-gmagick.changes 2020-01-04 19:22:05.749157297 +0100 @@ -1,0 +2,14 @@ +Sat Jan 4 12:16:04 UTC 2020 - Илья Индиго <[email protected]> + +- Refresh spec-file. + +------------------------------------------------------------------- +Sat Jan 4 11:16:08 UTC 2020 - Arjen de Korte <[email protected]> + +- Segfaults on shutdown need to be mitigated when GraphicsMagick is + compiled with OpenMP support and PHP >= 7.4 only. For GCC < 9, + the only option is to run in single thread mode, for GCC >= 9 + wait until OpenMP has relinquished its resources (modified + fix-segfault-on-shutdown.patch). + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php7-gmagick.spec ++++++ --- /var/tmp/diff_new_pack.tQjHNa/_old 2020-01-04 19:22:06.769157749 +0100 +++ /var/tmp/diff_new_pack.tQjHNa/_new 2020-01-04 19:22:06.769157749 +0100 @@ -1,7 +1,7 @@ # # spec file for package php7-gmagick # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -29,8 +29,8 @@ Source1: %{pkg_name}.ini # PATCH-FIX-UPSTREAM fix-segfault-on-shutdown.patch https://bugs.php.net/bug.php?id=78465 Patch0: fix-segfault-on-shutdown.patch -BuildRequires: %{php_name}-devel >= 7.0.1 -BuildRequires: GraphicsMagick-devel >= 1.3.17 +BuildRequires: %{php_name}-devel +BuildRequires: GraphicsMagick-devel BuildRequires: ghostscript-fonts-std BuildRequires: re2c Conflicts: php7-imagick @@ -50,26 +50,25 @@ %prep %setup -q -n %{pkg_name}-%{version} %patch0 -mkdir %{name} %build +export CFLAGS="%{optflags} -fvisibility=hidden %(GraphicsMagick-config --cflags)" %{_bindir}/phpize -export CFLAGS="%{optflags} -fvisibility=hidden" -%configure --with-%{pkg_name}=%{_usr} -make %{?_smp_mflags} +%configure +%make_build %check -make %{?_smp_mflags} PHP_EXECUTABLE=%{__php} NO_INTERACTION=1 test +%make_build PHP_EXECUTABLE=%{__php} NO_INTERACTION=1 test %install -make DESTDIR=%{buildroot} install INSTALL_ROOT=%{buildroot} +%make_install INSTALL_ROOT=%{buildroot} mkdir -p %{buildroot}%{_sysconfdir}/%{php_name}/conf.d -install --mode=0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{php_name}/conf.d/%{pkg_name}.ini +install -m644 %{SOURCE1} %{buildroot}%{_sysconfdir}/%{php_name}/conf.d/%{pkg_name}.ini %files -%{_libdir}/%{php_name}/extensions/%{pkg_name}.so %config(noreplace) %{_sysconfdir}/%{php_name}/conf.d/%{pkg_name}.ini %license LICENSE %doc CONTRIBUTORS.md README.md +%{_libdir}/%{php_name}/extensions/%{pkg_name}.so %changelog ++++++ fix-segfault-on-shutdown.patch ++++++ --- /var/tmp/diff_new_pack.tQjHNa/_old 2020-01-04 19:22:06.785157756 +0100 +++ /var/tmp/diff_new_pack.tQjHNa/_new 2020-01-04 19:22:06.785157756 +0100 @@ -1,16 +1,46 @@ There seems to be a problem when the program is terminating if GraphicsMagick has been compiled -with OpenMP support and has used more than one thread. It often segfaults in that case. +with OpenMP support and has used more than one thread. It often segfaults with PHP >= 7.4. + +The solution seems to be to explicitly let OpenMP relinquish its resources before terminating. +This is only possible on GCC >= 9, as this function was not available before. On GCC < 9 the +alternative is to run in single thread mode. + +Whether or not GraphicsMagick was compiled with OpenMP support, can be deterimined by adding +the output of `GraphicsMagick-config --cflags` to the CFLAGS, which will define _OPENMP in +that case. See https://bugs.php.net/bug.php?id=78465 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91256 --- gmagick.c +++ gmagick.c -@@ -1709,6 +1709,9 @@ +@@ -21,6 +21,10 @@ + #include "php_gmagick_macros.h" + #include "php_gmagick_helpers.h" + ++#if defined(_OPENMP) && (PHP_VERSION_ID >= 70400) && (__GNUC__ >= 9) ++#include <omp.h> ++#endif ++ + /* handlers */ + static zend_object_handlers gmagick_object_handlers; + static zend_object_handlers gmagickdraw_object_handlers; +@@ -1709,6 +1713,9 @@ PHP_MINIT_FUNCTION(gmagick) return FAILURE; InitializeMagick(cwd); -+#if PHP_VERSION_ID >= 70400 ++#if defined(_OPENMP) && (PHP_VERSION_ID >= 70400) && (__GNUC__ < 9) + SetMagickResourceLimit(ThreadsResource, 1); +#endif efree(cwd); /* init constants */ +@@ -1722,6 +1729,10 @@ PHP_MINIT_FUNCTION(gmagick) + PHP_MSHUTDOWN_FUNCTION(gmagick) + { + DestroyMagick(); ++#if defined(_OPENMP) && (PHP_VERSION_ID >= 70400) && (__GNUC__ >= 9) ++ /* Relinquish resources used by OpenMP on all devices */ ++ omp_pause_resource_all(omp_pause_hard); ++#endif + return SUCCESS; + } + /* }}} */
