summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2017-09-28 11:52:46 +0200
committerRemi Collet <remi@remirepo.net>2017-09-28 11:52:46 +0200
commitddc6ad28f34e17dc70e6e1cdc850d9f436b5bfda (patch)
treebfc6670859ffbc6f6395b9e9434e9cf4c2ea967c
parent6b2bdbb5c394ea38ac10a5952bb5d2d4c9417f12 (diff)
add upstreamm patch to ensure sodium_init can be run multiple time without failure
-rw-r--r--.gitignore8
-rw-r--r--libsodium-upstream.patch28
-rw-r--r--php-pecl-libsodium.spec10
3 files changed, 45 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..fc9aa8c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+clog
+package-*.xml
+*.tgz
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/libsodium-upstream.patch b/libsodium-upstream.patch
new file mode 100644
index 0000000..711dc70
--- /dev/null
+++ b/libsodium-upstream.patch
@@ -0,0 +1,28 @@
+Adapted for 1.0.6 from upstream:
+
+
+
+From ecbf0f15206d6898b26fc4c12a5c03a2e1609995 Mon Sep 17 00:00:00 2001
+From: Frank Denis <github@pureftpd.org>
+Date: Fri, 18 Aug 2017 19:21:08 +0200
+Subject: [PATCH] If sodium_init() returns 1, this is fine.
+
+We actually want to do this so that multiple extensions using libsodium
+can be loaded simultaneously.
+---
+ libsodium.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libsodium.c b/libsodium.c
+index 6eb2234..9089a31 100644
+--- a/libsodium.c
++++ b/libsodium.c
+@@ -257,7 +257,7 @@ ZEND_GET_MODULE(libsodium)
+
+ PHP_MINIT_FUNCTION(libsodium)
+ {
+- if (sodium_init() != 0) {
++ if (sodium_init() < 0) {
+ zend_error(E_ERROR, "sodium_init()");
+ }
+
diff --git a/php-pecl-libsodium.spec b/php-pecl-libsodium.spec
index e038ce5..b3a561e 100644
--- a/php-pecl-libsodium.spec
+++ b/php-pecl-libsodium.spec
@@ -24,12 +24,15 @@
Summary: Wrapper for the Sodium cryptographic library
Name: %{?sub_prefix}php-pecl-%{pecl_name}
Version: 1.0.6
-Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 5%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: BSD
Group: Development/Languages
URL: http://pecl.php.net/package/%{pecl_name}
Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
+# needed if libsodium.so loaded after sodium.so (only affects php 7.2)
+Patch0: %{pecl_name}-upstream.patch
+
# Ensure libsodium-last is used (upstream 0.6.0)
BuildRequires: pkgconfig(libsodium) >= 1.0.13
BuildRequires: %{?scl_prefix}php-devel > 5.4
@@ -102,6 +105,7 @@ sed -e 's/role="test"/role="src"/' \
-i package.xml
cd NTS
+%patch0 -p1 -b .upstream
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_LIBSODIUM_VERSION/{s/.* "//;s/".*$//;p}' php_libsodium.h)
@@ -229,6 +233,10 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Thu Sep 28 2017 Remi Collet <remi@fedoraproject.org> - 1.0.6-5
+- add upstreamm patch to ensure sodium_init can be run
+ multiple time without failure
+
* Thu Sep 28 2017 Remi Collet <remi@fedoraproject.org> - 1.0.6-4
- rebuild with PHP 7.2.0RC3