Hello community, here is the log from the commit of package php7-gmagick for openSUSE:Leap:15.2 checked in at 2020-05-23 16:07:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Leap:15.2/php7-gmagick (Old) and /work/SRC/openSUSE:Leap:15.2/.php7-gmagick.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "php7-gmagick" Sat May 23 16:07:09 2020 rev:3 rq:808173 version:2.0.5RC1 Changes: -------- --- /work/SRC/openSUSE:Leap:15.2/php7-gmagick/php7-gmagick.changes 2020-01-15 15:43:51.387269162 +0100 +++ /work/SRC/openSUSE:Leap:15.2/.php7-gmagick.new.2738/php7-gmagick.changes 2020-05-23 16:07:13.721028439 +0200 @@ -1,0 +2,20 @@ +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). + +------------------------------------------------------------------- +Sat Dec 28 21:07:31 UTC 2019 - Arjen de Korte <[email protected]> + +- Run in single thread mode by default to prevent a segfault on + shutdown in PHP 7.4 (fix-segfault-on-shutdown.patch) + +------------------------------------------------------------------- New: ---- fix-segfault-on-shutdown.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ php7-gmagick.spec ++++++ --- /var/tmp/diff_new_pack.1yxSzb/_old 2020-05-23 16:07:14.265029605 +0200 +++ /var/tmp/diff_new_pack.1yxSzb/_new 2020-05-23 16:07:14.265029605 +0200 @@ -1,7 +1,7 @@ # # spec file for package php7-gmagick # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# 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 @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -27,8 +27,10 @@ URL: https://pecl.php.net/package/gmagick Source0: https://pecl.php.net/get/%{pkg_name}-%{version}.tgz Source1: %{pkg_name}.ini -BuildRequires: %{php_name}-devel >= 7.0.1 -BuildRequires: GraphicsMagick-devel >= 1.3.17 +# 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 +BuildRequires: GraphicsMagick-devel BuildRequires: ghostscript-fonts-std BuildRequires: re2c Conflicts: php7-imagick @@ -47,26 +49,26 @@ %prep %setup -q -n %{pkg_name}-%{version} -mkdir %{name} +%patch0 %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 ++++++ 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 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 @@ -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 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; } /* }}} */
