summary refs log tree commit diff
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2021-12-16 18:44:45 +0100
committerTobias Geerinckx-Rice <me@tobias.gr>2021-12-16 19:06:50 +0100
commit88b4dcdabe512992ae79a50fc333e4e463d91634 (patch)
tree08f40e3c3304023e6cf08ab7b8c8cdfc533ea712
parent13f13554433c9dd47503131107dfbdd8a8031832 (diff)
downloadguix-88b4dcdabe512992ae79a50fc333e4e463d91634.tar.gz
gnu: php: Properly fix openssl_x509_checkpurpose_basic.phpt.
* gnu/packages/php.scm (php)[source]: Add patch.
* gnu/packages/patches/php-openssl_x509_checkpurpose_basic.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.

Thanks to Diego Nicola Barbato <dnbarbato@posteo.de>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/php-openssl_x509_checkpurpose_basic.patch108
-rw-r--r--gnu/packages/php.scm9
3 files changed, 113 insertions, 5 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 51c4f41331..2d91c95feb 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1601,6 +1601,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/perl-www-curl-fix-struct-void.patch	\
   %D%/packages/patches/perl-www-curl-remove-symbol.patch	\
   %D%/packages/patches/php-bug-74093-test.patch \
+  %D%/packages/patches/php-openssl_x509_checkpurpose_basic.patch	\
   %D%/packages/patches/picard-fix-id3-rename-test.patch		\
   %D%/packages/patches/picprog-non-intel-support.patch		\
   %D%/packages/patches/pidgin-add-search-path.patch		\
diff --git a/gnu/packages/patches/php-openssl_x509_checkpurpose_basic.patch b/gnu/packages/patches/php-openssl_x509_checkpurpose_basic.patch
new file mode 100644
index 0000000000..427965f231
--- /dev/null
+++ b/gnu/packages/patches/php-openssl_x509_checkpurpose_basic.patch
@@ -0,0 +1,108 @@
+From 98175fc7f1623873ceb2e9a017a319d19bfb3912 Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Sun, 12 Dec 2021 13:41:37 +0100
+Subject: [PATCH] Fix openssl_x509_checkpurpose_basic.phpt
+
+This test fails because san-cert.pem and san-ca.pem have expired.  We
+fix that by using the CertificateGenerator to generate temporary certs
+during the test run.  Since san-cert.pem and san-ca.pem have been
+identical, we only generate one certificate.
+
+Closes GH-7763.
+---
+ .../openssl_x509_checkpurpose_basic.phpt      | 10 +++++-
+ ext/openssl/tests/san-ca.pem                  | 15 ---------
+ ext/openssl/tests/san-cert.pem                | 31 -------------------
+ 3 files changed, 9 insertions(+), 47 deletions(-)
+ delete mode 100644 ext/openssl/tests/san-ca.pem
+ delete mode 100644 ext/openssl/tests/san-cert.pem
+
+diff --git a/ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt b/ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt
+index 99b4f0bdff31..35629bd93626 100644
+--- a/ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt
++++ b/ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt
+@@ -8,10 +8,14 @@ if (OPENSSL_VERSION_NUMBER < 0x10000000) die("skip Output requires OpenSSL 1.0")
+ ?>
+ --FILE--
+ <?php
++include 'CertificateGenerator.inc';
++$certificateGenerator = new CertificateGenerator();
++$certificateGenerator->saveCaCert(__DIR__ . "/san-cert.pem");
++
+ $cert = "file://" . __DIR__ . "/cert.crt";
+ $bert = "file://" . __DIR__ . "/bug41033.pem";
+ $sert = "file://" . __DIR__ . "/san-cert.pem";
+-$cpca = __DIR__ . "/san-ca.pem";
++$cpca = __DIR__ . "/san-cert.pem";
+ $utfl = __DIR__ . "/sni_server_uk.pem";
+ $rcrt = openssl_x509_read($cert);
+ 
+@@ -84,6 +88,10 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT, array($cpc
+ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN, array($cpca), $utfl));
+ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY, array($cpca), $utfl));
+ ?>
++--CLEAN--
++<?php
++@unlink(__DIR__ . "/san-cert.pem");
++?>
+ --EXPECT--
+ bool(false)
+ bool(false)
+diff --git a/ext/openssl/tests/san-ca.pem b/ext/openssl/tests/san-ca.pem
+deleted file mode 100644
+index 88682ba2dcf6..000000000000
+--- a/ext/openssl/tests/san-ca.pem
++++ /dev/null
+@@ -1,15 +0,0 @@
+------BEGIN CERTIFICATE-----
+-MIICYTCCAcqgAwIBAgIJAIaqxtY5dwjtMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
+-BAYTAlVTMQswCQYDVQQIEwJNTjEUMBIGA1UEBxMLTWlubmVhcG9saXMxITAfBgNV
+-BAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRlZDAeFw0xMzA5MjQwODA1NTFaFw0y
+-MTEyMTEwODA1NTFaMFMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJNTjEUMBIGA1UE
+-BxMLTWlubmVhcG9saXMxITAfBgNVBAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRl
+-ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsFGqfbU/8D+KjroQl4XMyt9m
+-dcSP7iZtqphOu9nVZxYAAqfaqj8FnC/pwYV3TU6ZHndLTQAllwYT3sQBQPPGmZQ9
+-clSIMEL003t3pi4ZVXkttG6Vvr+Z9PBcHhlKLQ7WMHnn4qctllWXTSoyTQpkETF3
+-Fc3mrG5G37BhoUno7NECAwEAAaM9MDswOQYDVR0RBDIwMIILZXhhbXBsZS5vcmeC
+-D3d3dy5leGFtcGxlLm9yZ4IQdGVzdC5leGFtcGxlLm9yZzANBgkqhkiG9w0BAQUF
+-AAOBgQBf/FZhzheIcQJ+dyTk8xQ/nJLvpmBhbd1LNtfwk/MsC9UHsz4QXs9sBw1k
+-rH0FjoqgM6avj7zKHJFTj6q7Rd+OX5V4HynYPhX67sWbN3KWEHffL98nGGd/bo3X
+-pSjNk5vnyKYiwdUUe11Ac9csh0HcSBbhOYjy0T/i9AlQcKbuCg==
+------END CERTIFICATE-----
+diff --git a/ext/openssl/tests/san-cert.pem b/ext/openssl/tests/san-cert.pem
+deleted file mode 100644
+index 923d490e72fd..000000000000
+--- a/ext/openssl/tests/san-cert.pem
++++ /dev/null
+@@ -1,31 +0,0 @@
+------BEGIN CERTIFICATE-----
+-MIICYTCCAcqgAwIBAgIJAIaqxtY5dwjtMA0GCSqGSIb3DQEBBQUAMFMxCzAJBgNV
+-BAYTAlVTMQswCQYDVQQIEwJNTjEUMBIGA1UEBxMLTWlubmVhcG9saXMxITAfBgNV
+-BAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRlZDAeFw0xMzA5MjQwODA1NTFaFw0y
+-MTEyMTEwODA1NTFaMFMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJNTjEUMBIGA1UE
+-BxMLTWlubmVhcG9saXMxITAfBgNVBAsTGERvbWFpbiBDb250cm9sIFZhbGlkYXRl
+-ZDCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAsFGqfbU/8D+KjroQl4XMyt9m
+-dcSP7iZtqphOu9nVZxYAAqfaqj8FnC/pwYV3TU6ZHndLTQAllwYT3sQBQPPGmZQ9
+-clSIMEL003t3pi4ZVXkttG6Vvr+Z9PBcHhlKLQ7WMHnn4qctllWXTSoyTQpkETF3
+-Fc3mrG5G37BhoUno7NECAwEAAaM9MDswOQYDVR0RBDIwMIILZXhhbXBsZS5vcmeC
+-D3d3dy5leGFtcGxlLm9yZ4IQdGVzdC5leGFtcGxlLm9yZzANBgkqhkiG9w0BAQUF
+-AAOBgQBf/FZhzheIcQJ+dyTk8xQ/nJLvpmBhbd1LNtfwk/MsC9UHsz4QXs9sBw1k
+-rH0FjoqgM6avj7zKHJFTj6q7Rd+OX5V4HynYPhX67sWbN3KWEHffL98nGGd/bo3X
+-pSjNk5vnyKYiwdUUe11Ac9csh0HcSBbhOYjy0T/i9AlQcKbuCg==
+------END CERTIFICATE-----
+------BEGIN PRIVATE KEY-----
+-MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBALBRqn21P/A/io66
+-EJeFzMrfZnXEj+4mbaqYTrvZ1WcWAAKn2qo/BZwv6cGFd01OmR53S00AJZcGE97E
+-AUDzxpmUPXJUiDBC9NN7d6YuGVV5LbRulb6/mfTwXB4ZSi0O1jB55+KnLZZVl00q
+-Mk0KZBExdxXN5qxuRt+wYaFJ6OzRAgMBAAECgYB11e5iWvqjPmQEZRdnnJU0VD8u
+-n7ItT+Nk6qtb4gY8Abj6DWIW+01th5vqqJ8FvGyartFVYa69kuM+srG/zevAZWeu
+-fGZtwiwZR4DRSyRcPp4rnNiksK3dkAZA6UewmRDPv8uyHJlXc5i+Ft1ILJ5Q5jgn
+-UkC4z3EJP5Se9KZywQJBAOO4lRq42wLsYr2SDrQDSs4leie3FKc2bgvjF7Djosh1
+-ZYbf55F5b9w1zgnccmni2HkqOnyFu4SKarmXyCsYxrkCQQDGNvnUh7/zZswrdWZ/
+-PMp9zVDTh/5Oc2B4ByNLw1ERDwYhjchKgPRlQvn4cp3Pwf3UYPQ/8XGXzzEJey3A
+-r0rZAkBf/tDEOgcBPXsGZQrTscuYCU5sbY5ESvqrAilbhSp7DJom+D5bIfEYyIm5
+-uHd20Yzlzvpmwc1huyPwZt6X5FLpAkATDReoGMAXSesXxjnqwtIHk2NQYYLM0YQV
+-JUJ8NrKk/Bevw+vbVVeoH+7ctU97t36JGiR/vNoZKD3jVmaIXZDJAkEA4wJbwzIo
+-L32mu9VmZa7wjmfkraQEmXTPaA5D9lNC0AwRTgkj+x2Qe1vawNblNK9PPLBDdplQ
+-L//53ADq/wv5rA==
+------END PRIVATE KEY-----
diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index a633e0790b..191dcafb4a 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -70,7 +70,9 @@
               (sha256
                (base32
                 "1y0f1xgfi8cks6npdhrycg8r9g3q0pikqgf5h4xafpy8znmb61g3"))
-              (patches (search-patches "php-bug-74093-test.patch"))
+              (patches
+               (search-patches "php-bug-74093-test.patch"
+                               "php-openssl_x509_checkpurpose_basic.patch"))
               (modules '((guix build utils)))
               (snippet
                '(with-directory-excursion "ext"
@@ -343,10 +345,7 @@
                          ;; Renicing a process fails in the build environment.
                          "ext/standard/tests/general_functions/proc_nice_basic.phpt"
                          ;; Can fail on fast machines?
-                         "Zend/tests/bug74093.phpt"
-
-                         ;; Unknown reason <https://issues.guix.gnu.org/52513>.
-                         "ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt"))
+                         "Zend/tests/bug74093.phpt"))
 
              ;; Accomodate two extra openssl errors flanking the expected one:
              ;; random number generator:RAND_{load,write}_file:Cannot open file