diff options
| -rw-r--r-- | 266.patch | 69 | ||||
| -rw-r--r-- | php-snuffleupagus.spec | 16 | 
2 files changed, 77 insertions, 8 deletions
diff --git a/266.patch b/266.patch new file mode 100644 index 0000000..3271e39 --- /dev/null +++ b/266.patch @@ -0,0 +1,69 @@ +From 1e152059e17a50f95d739cdcf22dc499bb3ec7ad Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Thu, 13 Dec 2018 08:08:55 +0100 +Subject: [PATCH] use php script, get rid of python for test suite + +--- + scripts/upload_validation.php               | 45 +++++++++++++++++++++ + src/tests/config/upload_validation_real.ini |  2 +- + 2 files changed, 46 insertions(+), 1 deletion(-) + create mode 100755 scripts/upload_validation.php + +diff --git a/scripts/upload_validation.php b/scripts/upload_validation.php +new file mode 100755 +index 0000000..71f83e6 +--- /dev/null ++++ b/scripts/upload_validation.php +@@ -0,0 +1,45 @@ ++#!/usr/bin/env php ++<?php ++ ++function check($filename) { ++ ++	$whitelist = ['ECHO', 'RETURN', 'PHP', 'NOP']; ++ ++	$out = []; ++	$ret = 0; ++	$cmd = [ ++		PHP_BINARY, ++		"-d", "vld.active=1", ++		"-d", "vld.execute=0", ++		"-d", "extension=vld.so", ++		"-d", "vld.format=1", ++		"-d", "vld.col_sep=@", ++		"-d", "log_errors=0", ++		"-d", "error_log=/dev/null", ++		$filename, ++		'2>&1', ++		]; ++	exec(implode(' ', $cmd), $out, $ret); ++	if ($ret) { ++        printf("Error: %d\n", $ret); ++		return 2; ++	} ++	foreach($out as $line) { ++		$sp = explode('@', $line); ++		if (count($sp) < 5) { ++			continue; ++		} ++		$opcode = $sp[4]; // # ,line, #, EIO, op, fetch, ext, return, operands ++		if ($opcode && !in_array($opcode, $whitelist)) { ++			printf("Upload_validation: Found an opcode: %s\n", $opcode); ++			return 1; ++		} ++	} ++	return 0; ++} ++ ++if ($_SERVER['argc'] != 2) { ++	die("Usage: {$_SERVER['argv']['0']} file_to_test.php\n"); ++} ++exit(check($_SERVER['argv']['1'])); ++ +diff --git a/src/tests/config/upload_validation_real.ini b/src/tests/config/upload_validation_real.ini +index 6463466..690e9bf 100644 +--- a/src/tests/config/upload_validation_real.ini ++++ b/src/tests/config/upload_validation_real.ini +@@ -1 +1 @@ +-sp.upload_validation.script("../scripts/upload_validation.py").enable(); ++sp.upload_validation.script("../scripts/upload_validation.php").enable(); diff --git a/php-snuffleupagus.spec b/php-snuffleupagus.spec index d08f0f2..0a3e139 100644 --- a/php-snuffleupagus.spec +++ b/php-snuffleupagus.spec @@ -35,7 +35,7 @@ Version:       0.4.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:       3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release:       4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}  %endif  License:       LGPLv3  Group:         Development/Languages @@ -43,17 +43,12 @@ 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:        https://patch-diff.githubusercontent.com/raw/nbs-system/snuffleupagus/pull/242.patch +Patch1:        https://patch-diff.githubusercontent.com/raw/nbs-system/snuffleupagus/pull/266.patch  BuildRequires: %{?dtsprefix}gcc  BuildRequires: %{?scl_prefix}php-devel > 7  BuildRequires: pcre-devel  # For tests/upload_validation_real.phpt -%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8 -%global python %{_root_bindir}/python3 -%else -%global python %{_root_bindir}/python -%endif -BuildRequires: %{python}  BuildRequires: %{?scl_prefix}php-vld  #BuildRequires: gdb  #BuildRequires: php-debuginfo @@ -100,6 +95,7 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO  %prep  %setup -q -n %{gh_project}-%{gh_commit}  %patch0 -p1 -b .pr242 +%patch1 -p1 -b .pr266  cd src  # Sanity check, really often broken @@ -176,7 +172,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}  rm src/tests/stream_wrapper.phpt  %endif -sed -e 's:#!/usr/bin/python:#!%{python}:' -i scripts/upload_validation.py +sed -e 's:#!/usr/bin/env php:#!%{__php}:' -i scripts/upload_validation.php  cd src  : Minimal load test for NTS extension @@ -225,6 +221,10 @@ REPORT_EXIT_STATUS=1 \  %changelog +* Thu Dec 13 2018 Remi Collet <remi@remirepo.net> - 0.4.0-4 +- drop dependency on python, test build for +  https://github.com/nbs-system/snuffleupagus/pull/266 +  * Tue Dec  4 2018 Remi Collet <remi@remirepo.net> - 0.4.0-3  - EL-8 build  | 
