summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-01-05 08:24:55 +0100
committerRemi Collet <remi@php.net>2023-01-05 08:24:55 +0100
commitd6dd131e6780e6b0b4b69b0397b01f2fbb8e09d6 (patch)
treed42b6c5b89b2008a5983e5923a0c8691ba34a589
parent0470e56a3d93d1e92d01d7c4071fb5262e916c2e (diff)
test build for upstream fix for gh#444
-rw-r--r--php-snuffleupagus.spec12
-rw-r--r--upstream.patch277
2 files changed, 284 insertions, 5 deletions
diff --git a/php-snuffleupagus.spec b/php-snuffleupagus.spec
index b0994a0..d2e82b7 100644
--- a/php-snuffleupagus.spec
+++ b/php-snuffleupagus.spec
@@ -36,13 +36,15 @@ Version: 0.9.0
%if 0%{?gh_date}
Release: 1%{gh_date}.%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%else
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%endif
License: LGPL-3.0-only
Group: Development/Languages
URL: https://github.com/%{gh_owner}/%{gh_project}
Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pkg_name}-%{version}-%{gh_short}.tar.gz
+Patch0: upstream.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.0
BuildRequires: pcre-devel
@@ -73,6 +75,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -q -n %{gh_project}-%{gh_commit}
+%patch0 -p1
cd src
# Sanity check, really often broken
@@ -166,10 +169,6 @@ fi
%if "%{php_version}" < "8"
rm -rf src/tests/*php8*/
%endif
-%if "%{php_version}" > "8.2"
-# https://github.com/jvoisin/snuffleupagus/issues/444
-rm -rf src/tests/deny_writable
-%endif
export SP_SKIP_OLD_PHP_CHECK=1
@@ -227,6 +226,9 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Thu Jan 5 2023 Remi Collet <remi@remirepo.net> - 0.9.0-2
+- test build for upstream fix for gh#444
+
* Wed Jan 4 2023 Remi Collet <remi@remirepo.net> - 0.9.0-1
- update to 0.9.0
- open https://github.com/jvoisin/snuffleupagus/issues/444 borked tests with 8.2
diff --git a/upstream.patch b/upstream.patch
new file mode 100644
index 0000000..aa212c8
--- /dev/null
+++ b/upstream.patch
@@ -0,0 +1,277 @@
+From 1bf0f3ec9088d34383c564d6306901ae6dc94cb5 Mon Sep 17 00:00:00 2001
+From: jvoisin <julien.voisin@dustri.org>
+Date: Wed, 4 Jan 2023 19:06:28 +0100
+Subject: [PATCH] Fix the CI for PHP8.2
+
+---
+ .../deny_writable_execution.phpt | 10 ++--------
+ .../deny_writable_execution_simulation.phpt | 20 +++++++------------
+ .../dump_deny_writable_execution.phpt | 10 ++--------
+ .../disabled_function_echo.phpt | 1 -
+ .../disabled_function_echo_2.phpt | 1 -
+ .../disabled_function_echo_local_var.phpt | 1 -
+ .../disabled_function_print.phpt | 3 +--
+ src/tests/xxe/disable_xxe_dom_disabled.phpt | 9 +++------
+ src/tests/xxe/disable_xxe_simplexml.phpt | 9 +++------
+ src/tests/xxe/disable_xxe_simplexml_oop.phpt | 9 +++------
+ src/tests/xxe/disable_xxe_xml_parse.phpt | 13 +++++-------
+ 11 files changed, 26 insertions(+), 60 deletions(-)
+
+diff --git a/src/tests/deny_writable/deny_writable_execution.phpt b/src/tests/deny_writable/deny_writable_execution.phpt
+index a6294797..383ffa57 100644
+--- a/src/tests/deny_writable/deny_writable_execution.phpt
++++ b/src/tests/deny_writable/deny_writable_execution.phpt
+@@ -21,6 +21,8 @@ sp.configuration_file={PWD}/config/config_disable_writable.ini
+ $dir = __DIR__;
+
+ // just in case
++@chmod("$dir/non_writable_file.txt", 0777);
++@chmod("$dir/writable_file.txt", 0777);
+ @unlink("$dir/non_writable_file.txt");
+ @unlink("$dir/writable_file.txt");
+
+@@ -31,13 +33,5 @@ chmod("$dir/writable_file.txt", 0777);
+ include "$dir/non_writable_file.txt";
+ include "$dir/writable_file.txt";
+ ?>
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-chmod("$dir/non_writable_file.txt", 0777);
+-chmod("$dir/writable_file.txt", 0777);
+-unlink("$dir/non_writable_file.txt");
+-unlink("$dir/writable_file.txt");
+-?>
+ --EXPECTF--
+ Fatal error: [snuffleupagus][0.0.0.0][readonly_exec][drop] Attempted execution of a writable file (%a/deny_writable_execution.php) in %a/deny_writable_execution.php on line 2
+diff --git a/src/tests/deny_writable/deny_writable_execution_simulation.phpt b/src/tests/deny_writable/deny_writable_execution_simulation.phpt
+index d4e48018..39dab32f 100644
+--- a/src/tests/deny_writable/deny_writable_execution_simulation.phpt
++++ b/src/tests/deny_writable/deny_writable_execution_simulation.phpt
+@@ -22,6 +22,8 @@ sp.configuration_file={PWD}/config/config_disable_writable_simulation.ini
+ $dir = __DIR__;
+
+ // just in case
++@chmod("$dir/non_writable_file.txt", 0777);
++@chmod("$dir/writable_file.txt", 0777);
+ @unlink("$dir/non_writable_file.txt");
+ @unlink("$dir/writable_file.txt");
+
+@@ -32,23 +34,15 @@ chmod("$dir/non_writable_file.txt", 0400);
+ include "$dir/writable_file.txt";
+ include "$dir/non_writable_file.txt";
+ ?>
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-chmod("$dir/non_writable_file.txt", 0777);
+-chmod("$dir/writable_file.txt", 0777);
+-unlink("$dir/non_writable_file.txt");
+-unlink("$dir/writable_file.txt");
+-?>
+ --EXPECTF--
+-Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/deny_writable_execution_simulation.php) in %a/deny_writable_execution_simulation.php on line 2
++Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/deny_writable_execution_simulation.php) in %a/deny_writable_execution_simulation.php on line %d
+
+-Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/writable_file.txt) in %a/deny_writable_execution_simulation.php on line 12
++Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/writable_file.txt) in %a/deny_writable_execution_simulation.php on line %d
+
+-Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/writable_file.txt) in %a/writable_file.txt on line 1
++Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a writable file (%a/writable_file.txt) in %a/writable_file.txt on line %d
+ Code execution within a writable file.
+
+-Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a file owned by the PHP process (%s/tests/deny_writable/non_writable_file.txt) in %s/tests/deny_writable/deny_writable_execution_simulation.php on line 13
++Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a file owned by the PHP process (%s/tests/deny_writable/non_writable_file.txt) in %s/tests/deny_writable/deny_writable_execution_simulation.php on line %d
+
+-Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a file owned by the PHP process (%s/tests/deny_writable/non_writable_file.txt) in %src/tests/deny_writable/non_writable_file.txt on line 1
++Warning: [snuffleupagus][0.0.0.0][readonly_exec][simulation] Attempted execution of a file owned by the PHP process (%s/tests/deny_writable/non_writable_file.txt) in %src/tests/deny_writable/non_writable_file.txt on line %d
+ Code execution within a non-writable file.
+diff --git a/src/tests/deny_writable/dump_deny_writable_execution.phpt b/src/tests/deny_writable/dump_deny_writable_execution.phpt
+index c6dd6cd8..2e6bca51 100644
+--- a/src/tests/deny_writable/dump_deny_writable_execution.phpt
++++ b/src/tests/deny_writable/dump_deny_writable_execution.phpt
+@@ -32,6 +32,8 @@ foreach (glob("/tmp/dump_result/sp_dump.*") as $dump) {
+ $dir = __DIR__;
+
+ // just in case
++@chmod("$dir/non_writable_file.txt", 0777);
++@chmod("$dir/writable_file.txt", 0777);
+ @unlink("$dir/non_writable_file.txt");
+ @unlink("$dir/writable_file.txt");
+
+@@ -57,11 +59,3 @@ if ($res[2] != "GET:get_a='data_get_a_readonly' get_b='data_get_b_readonly' \n")
+ --EXPECTF--
+ %a
+ WIN
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-chmod("$dir/non_writable_file.txt", 0777);
+-chmod("$dir/writable_file.txt", 0777);
+-unlink("$dir/non_writable_file.txt");
+-unlink("$dir/writable_file.txt");
+-?>
+diff --git a/src/tests/disable_function/disabled_function_echo.phpt b/src/tests/disable_function/disabled_function_echo.phpt
+index 12aaff48..b1da0dca 100644
+--- a/src/tests/disable_function/disabled_function_echo.phpt
++++ b/src/tests/disable_function/disabled_function_echo.phpt
+@@ -13,7 +13,6 @@ echo "qwe";
+ test("rty");
+ test("oops");
+ ?>
+---CLEAN--
+ --EXPECTF--
+ qwerty
+ Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/disabled_function_echo.php on line 3
+diff --git a/src/tests/disable_function/disabled_function_echo_2.phpt b/src/tests/disable_function/disabled_function_echo_2.phpt
+index 82a2fa1d..c1d98170 100644
+--- a/src/tests/disable_function/disabled_function_echo_2.phpt
++++ b/src/tests/disable_function/disabled_function_echo_2.phpt
+@@ -9,7 +9,6 @@ sp.configuration_file={PWD}/config/disabled_function_echo.ini
+ echo "qwe";
+ echo "1", "oops";
+ ?>
+---CLEAN--
+ --EXPECTF--
+ qwe1
+ Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/disabled_function_echo_2.php on line 3
+diff --git a/src/tests/disable_function/disabled_function_echo_local_var.phpt b/src/tests/disable_function/disabled_function_echo_local_var.phpt
+index ee1be1fb..52d1f481 100644
+--- a/src/tests/disable_function/disabled_function_echo_local_var.phpt
++++ b/src/tests/disable_function/disabled_function_echo_local_var.phpt
+@@ -14,7 +14,6 @@ test();
+ $abc = 123;
+ test();
+ ?>
+---CLEAN--
+ --EXPECTF--
+ 3
+
+diff --git a/src/tests/disable_function/disabled_function_print.phpt b/src/tests/disable_function/disabled_function_print.phpt
+index ec1b04f8..96008546 100644
+--- a/src/tests/disable_function/disabled_function_print.phpt
++++ b/src/tests/disable_function/disabled_function_print.phpt
+@@ -13,7 +13,6 @@ print "qwe";
+ test("rty");
+ test("oops");
+ ?>
+---CLEAN--
+ --EXPECTF--
+ qwerty
+-Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/disabled_function_print.php on line 3
+\ No newline at end of file
++Fatal error: [snuffleupagus][0.0.0.0][disabled_function][drop] Aborted execution on call of the function 'echo' in %a/disabled_function_print.php on line 3
+diff --git a/src/tests/xxe/disable_xxe_dom_disabled.phpt b/src/tests/xxe/disable_xxe_dom_disabled.phpt
+index 4a888edb..20399ecf 100644
+--- a/src/tests/xxe/disable_xxe_dom_disabled.phpt
++++ b/src/tests/xxe/disable_xxe_dom_disabled.phpt
+@@ -10,6 +10,9 @@ dom
+ --FILE--
+ <?php
+ $dir = __DIR__;
++@unlink($dir . "/content.xml");
++@unlink($dir . "/content.txt");
++
+ $content = '<content>WARNING, external entity loaded!</content>';
+ file_put_contents($dir . '/content.txt', $content);
+
+@@ -52,9 +55,3 @@ libxml_disable_entity to false: WARNING, external entity loaded!
+
+ Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_disable_entity_loader was tried and nopped in %s/tests/xxe/disable_xxe_dom_disabled.php on line %d
+ without xxe: foo
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-unlink($dir . "/content.xml");
+-unlink($dir . "/content.txt");
+-?>
+diff --git a/src/tests/xxe/disable_xxe_simplexml.phpt b/src/tests/xxe/disable_xxe_simplexml.phpt
+index 95601563..8a4f0333 100644
+--- a/src/tests/xxe/disable_xxe_simplexml.phpt
++++ b/src/tests/xxe/disable_xxe_simplexml.phpt
+@@ -11,6 +11,9 @@ simplexml
+ --FILE--
+ <?php
+ $dir = __DIR__;
++@unlink($dir . "/content.xml");
++@unlink($dir . "/content.txt");
++
+ $content = 'WARNING, external entity loaded!';
+ file_put_contents('content.txt', $content);
+
+@@ -44,9 +47,3 @@ printf("without xxe: %s", $doc->testing);
+ libxml_disable_entity to true:
+ libxml_disable_entity to false:
+ without xxe: foo
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-unlink($dir . "/content.xml");
+-unlink($dir . "/content.txt");
+-?>
+diff --git a/src/tests/xxe/disable_xxe_simplexml_oop.phpt b/src/tests/xxe/disable_xxe_simplexml_oop.phpt
+index 1b2c4cac..c28c3649 100644
+--- a/src/tests/xxe/disable_xxe_simplexml_oop.phpt
++++ b/src/tests/xxe/disable_xxe_simplexml_oop.phpt
+@@ -11,6 +11,9 @@ simplexml
+ --FILE--
+ <?php
+ $dir = __DIR__;
++@unlink($dir . "/content.xml");
++@unlink($dir . "/content.txt");
++
+ $content = 'WARNING, external entity loaded!';
+ file_put_contents('content.txt', $content);
+
+@@ -44,9 +47,3 @@ printf("without xxe: %s", $doc->testing);
+ libxml_disable_entity to true:
+ libxml_disable_entity to false:
+ without xxe: foo
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-unlink($dir . "/content.xml");
+-unlink($dir . "/content.txt");
+-?>
+diff --git a/src/tests/xxe/disable_xxe_xml_parse.phpt b/src/tests/xxe/disable_xxe_xml_parse.phpt
+index bc7e338b..4a8292d7 100644
+--- a/src/tests/xxe/disable_xxe_xml_parse.phpt
++++ b/src/tests/xxe/disable_xxe_xml_parse.phpt
+@@ -16,6 +16,9 @@ sp.configuration_file={PWD}/config/disable_xxe.ini
+ --FILE--
+ <?php
+ $dir = __DIR__;
++@unlink($dir . "/content.xml");
++@unlink($dir . "/content.txt");
++
+ $content = 'WARNING, external entity loaded!';
+ file_put_contents('content.txt', $content);
+
+@@ -71,7 +74,7 @@ $doc = xml_parse($parser, $xml, true);
+ xml_parser_free($parser);
+
+ --EXPECTF--
+-Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_disable_entity_loader was tried and nopped in %a.php on line 41
++Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_disable_entity_loader was tried and nopped in %a.php on line %d
+ string(4) "TEST"
+
+ array(0) {
+@@ -83,7 +86,7 @@ array(0) {
+ string(7) "TESTING"
+ string(4) "TEST"
+
+-Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_disable_entity_loader was tried and nopped in %a.php on line 46
++Warning: [snuffleupagus][0.0.0.0][xxe][log] A call to libxml_disable_entity_loader was tried and nopped in %a.php on line %d
+ string(4) "TEST"
+
+ array(0) {
+@@ -104,9 +107,3 @@ array(0) {
+ }
+ textfoostring(7) "TESTING"
+ string(4) "TEST"
+---CLEAN--
+-<?php
+-$dir = __DIR__;
+-unlink($dir . "/content.xml");
+-unlink($dir . "/content.txt");
+-?>