community/uwsgi to 2.0.19.1-1

This commit is contained in:
Kevin Mihelich 2020-06-21 01:41:47 +00:00
parent 32988a86ae
commit b1c9ac6c97
3 changed files with 4 additions and 215 deletions

View file

@ -23,8 +23,8 @@ pkgname=(uwsgi
uwsgi-plugin-webdav
uwsgi-plugin-zabbix
uwsgi-plugin-notfound)
pkgver=2.0.18
pkgrel=7
pkgver=2.0.19.1
pkgrel=1
arch=(x86_64)
url="http://projects.unbit.it/$pkgbase"
license=(GPL2)
@ -41,21 +41,19 @@ source=("https://projects.unbit.it/downloads/$pkgbase-$pkgver.tar.gz"
uwsgi_at.service
uwsgi_at.socket
uwsgi_ruby20_compatibility.patch
fix-php74.patch
uwsgi_trick_chroot.patch
emperor.ini
emperor.uwsgi.service
emperor.uwsgi.socket
uwsgi.logrotate
uwsgi.sysusers)
sha512sums=('6561703279bcc4a81311d033810ac066d0f113bab13b0942f3eef86cac29c584a6641b52476840d6895151aee5ed064ae2d03b18932cf7f47e62f4eeed76da61'
sha512sums=('e18359c5ea3606d5de7fb3a0074d777e1c4b41f51f4b1a21f1446f32253058d7924286d9ed8a159d4c6e6c0ea64df7fc3c70b2933c3433b9a9cce39737e702bf'
'68eef703de39cb336915e1e9c36b11c65c2d46482407b0234ca245df0e052952abb7dd85b0a1cd4507c78356a3b7a55424524b3aa0997b559b51e7b20eab5e16'
'acfe9fb089d1905c3d736dbeaaef7eb1848b4ce8d1f585de653086cf7f90c166a1e493d0b62ba030a4bcf2eca9c919e0d6deea2ea1c0bcb8533d7cb040d2f67c'
'4def9dcd06cfc2c6ce554add9d9545a01f3bb2681f0a2a6fc4ba68f91011111803a955cc41b5e70832ca448b196109368fdf874e81b7ec0edee4b51f864e16f7'
'c0c1a5c2d31cdb7e0dc878ea3d0b6025532fb640ae7cf4d5f1eed2f89987e625c8dc7844d367283ed560fb3ef37915e3e9199be2e1b06fc4586ca862a653b4b5'
'fb51a4d102a1bc7d9f7d4c4f310ee65076bcfbc94b47e2dafdf9b20e99a661c5f938185dcf698437d81409376f0276b966f09b13c8a29462c48612df43c3f3ef'
'162ca1be96282b32e8e6be919b6315bfd08954c491056958985bf99e7f5bdad3511665f059329d6cb6ef5d222f9aa11d4dc43c72e6a963ab941ada959fe8d964'
'52a9c2e5d5c3841d22d4e87f46c7a1e9de0350bb2aca854b899d5729132156116ab4db4ca7d99d79aacf846812adf0db0c4f7cedf4575767266a713e622827a6'
'bc30f8ec69abd14fb96ada5b36cf65811a7a63ee27e224fcb6ceabe9935c1f17379cd872149a17da3d590b8ff60fbe7f77140d777aaf06e25e83388f897f611d'
'd54c84838ddb2f389e115ebb81aa2583705c9e330f020e6583b496f9c271ed236b6820c2a065f2b55a79adbf13e262b9ff2428124a8044b8fa20ca29ca4930ac'
'83a6859d729bf186236aaa7fb7433415f6b985f17e05b7ac571d8919bbf1fb9bd577b4f673d9787dea09752e3d8043f47ce3d9c7d5690faaa1365e477e6c9388'
@ -66,8 +64,7 @@ sha512sums=('6561703279bcc4a81311d033810ac066d0f113bab13b0942f3eef86cac29c584a66
prepare() {
cd $srcdir/$pkgbase-$pkgver
cp $srcdir/archlinux.ini buildconf/archlinux.ini
for patch in fix-php74.patch uwsgi_ruby20_compatibility.patch uwsgi_trick_chroot.patch; do
msg2 "Applying $patch"
for patch in uwsgi_ruby20_compatibility.patch uwsgi_trick_chroot.patch; do
patch -Np1 -i $srcdir/$patch
done
rm -rf plugins/ruby

View file

@ -1,39 +0,0 @@
From c4a2ad579a2fe5d357f2d6486c1afe84ef18a029 Mon Sep 17 00:00:00 2001
From: Arne Welzel <arne.welzel@gmail.com>
Date: Sun, 8 Dec 2019 12:59:45 +0100
Subject: [PATCH] php: Properly zero initialize zend_file_handle
In the PHP bugtracker [1], the stacktrace included a bogus pointer value
being passed to `_efree`. The ASCII value of the pointer is "02.11.81"
which heavily pointed at usage of non-initialized data.
#1 0x00007f8fe07e9e96 in _efree (ptr=0x30322e31312e3831) at /data/work/php-src-php-7.4.0RC6/Zend/zend_alloc.c:2549
The solution is to use an open-coded version of`zend_stream_init_filename()` [2].
Maybe we could actually use the above helper, but I'm not familiar enough
with PHP/versions/compat, so the proposed change seems safer.
Should fix #2096.
[1] https://bugs.php.net/bug.php?id=78828
[2] https://github.com/php/php-src/blob/bc6e4b6c574261188519a1e83ba49998ffbcb12b/Zend/zend_stream.c#L70
---
plugins/php/php_plugin.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c
index 72c390223..1690fb60c 100644
--- a/plugins/php/php_plugin.c
+++ b/plugins/php/php_plugin.c
@@ -1115,10 +1115,9 @@ int uwsgi_php_request(struct wsgi_request *wsgi_req) {
SG(request_info).path_translated = wsgi_req->file;
+ memset(&file_handle, 0, sizeof(zend_file_handle));
file_handle.type = ZEND_HANDLE_FILENAME;
file_handle.filename = real_filename;
- file_handle.free_filename = 0;
- file_handle.opened_path = NULL;
if (php_request_startup(TSRMLS_C) == FAILURE) {
uwsgi_500(wsgi_req);

View file

@ -1,169 +0,0 @@
From 4d79e13acaf13acdf8f8a84cfa3fdda211f8aa81 Mon Sep 17 00:00:00 2001
From: Unbit <info@unbit.it>
Date: Tue, 29 Dec 2015 08:53:19 +0100
Subject: [PATCH 12/12] official php7 support (beta) #1124
---
plugins/php/common.h | 4 ++++
plugins/php/php_plugin.c | 20 ++++++++++++++++++++
plugins/php/session.c | 19 ++++++++++++++++++-
plugins/php/uwsgiplugin.py | 4 +++-
4 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/plugins/php/common.h b/plugins/php/common.h
index 8c1ed13..9bf1c06 100644
--- a/plugins/php/common.h
+++ b/plugins/php/common.h
@@ -3,7 +3,11 @@
#include "php_main.h"
#include "php_variables.h"
+#if (PHP_MAJOR_VERSION < 7)
#include "ext/standard/php_smart_str.h"
+#else
+#define UWSGI_PHP7
+#endif
#include "ext/standard/info.h"
#include "ext/session/php_session.h"
diff --git a/plugins/php/php_plugin.c b/plugins/php/php_plugin.c
index b1b6f7a..6d9e952 100644
--- a/plugins/php/php_plugin.c
+++ b/plugins/php/php_plugin.c
@@ -65,7 +65,11 @@ struct uwsgi_option uwsgi_php_options[] = {
};
+#ifdef UWSGI_PHP7
+static size_t sapi_uwsgi_ub_write(const char *str, size_t str_length TSRMLS_DC)
+#else
static int sapi_uwsgi_ub_write(const char *str, uint str_length TSRMLS_DC)
+#endif
{
struct wsgi_request *wsgi_req = (struct wsgi_request *) SG(server_context);
@@ -111,7 +115,11 @@ static int sapi_uwsgi_send_headers(sapi_headers_struct *sapi_headers TSRMLS_DC)
return SAPI_HEADER_SENT_SUCCESSFULLY;
}
+#ifdef UWSGI_PHP7
+static size_t sapi_uwsgi_read_post(char *buffer, size_t count_bytes TSRMLS_DC)
+#else
static int sapi_uwsgi_read_post(char *buffer, uint count_bytes TSRMLS_DC)
+#endif
{
uint read_bytes = 0;
@@ -235,7 +243,11 @@ PHP_MINIT_FUNCTION(uwsgi_php_minit) {
}
PHP_FUNCTION(uwsgi_version) {
+#ifdef UWSGI_PHP7
+ RETURN_STRING(UWSGI_VERSION);
+#else
RETURN_STRING(UWSGI_VERSION, 1);
+#endif
}
PHP_FUNCTION(uwsgi_worker_id) {
@@ -321,7 +333,11 @@ PHP_FUNCTION(uwsgi_cache_get) {
if (value) {
char *ret = estrndup(value, valsize);
free(value);
+#ifdef UWSGI_PHP7
+ RETURN_STRING(ret);
+#else
RETURN_STRING(ret, 0);
+#endif
}
RETURN_NULL();
}
@@ -425,7 +441,11 @@ PHP_FUNCTION(uwsgi_rpc) {
// here we do not free varargs for performance reasons
char *ret = estrndup(response, size);
free(response);
+#ifdef UWSGI_PHP7
+ RETURN_STRING(ret);
+#else
RETURN_STRING(ret, 0);
+#endif
}
clear:
diff --git a/plugins/php/session.c b/plugins/php/session.c
index 40f9ef7..2312b6b 100644
--- a/plugins/php/session.c
+++ b/plugins/php/session.c
@@ -12,21 +12,34 @@ PS_CLOSE_FUNC(uwsgi) {
PS_READ_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
uint64_t valsize = 0;
- char *value = uwsgi_cache_magic_get((char *)key, strlen(key), &valsize, NULL, cache);
+#ifdef UWSGI_PHP7
+ char *value = uwsgi_cache_magic_get(key->val, key->len , &valsize, NULL, cache);
+#else
+ char *value = uwsgi_cache_magic_get((char *)key, strlen((char *)key), &valsize, NULL, cache);
+#endif
if (!value) return FAILURE;
+#ifdef UWSGI_PHP7
+ *val = zend_string_init(value, valsize, 0);
+#else
char *new_val = emalloc(valsize);
memcpy(new_val, value, valsize);
free(value);
*val = new_val;
*vallen = valsize;
+#endif
return SUCCESS;
}
PS_WRITE_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
+#ifdef UWSGI_PHP7
+ if (val->len == 0) return SUCCESS;
+ if (!uwsgi_cache_magic_set(key->val, key->len, val->val, val->len, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) {
+#else
if (vallen == 0) return SUCCESS;
if (!uwsgi_cache_magic_set((char *)key, strlen(key), (char *)val, vallen, 0, UWSGI_CACHE_FLAG_UPDATE, cache)) {
+#endif
return SUCCESS;
}
return FAILURE;
@@ -34,7 +47,11 @@ PS_WRITE_FUNC(uwsgi) {
PS_DESTROY_FUNC(uwsgi) {
char *cache = PS_GET_MOD_DATA();
+#ifdef UWSGI_PHP7
+ if (!uwsgi_cache_magic_del(key->val, key->len, cache)) {
+#else
if (!uwsgi_cache_magic_del((char *)key, strlen(key), cache)) {
+#endif
return SUCCESS;
}
return FAILURE;
diff --git a/plugins/php/uwsgiplugin.py b/plugins/php/uwsgiplugin.py
index e7ce425..45c58e5 100644
--- a/plugins/php/uwsgiplugin.py
+++ b/plugins/php/uwsgiplugin.py
@@ -12,6 +12,8 @@ if phpdir:
PHPPATH = os.environ.get('UWSGICONFIG_PHPPATH', PHPPATH)
+php_version = os.popen(PHPPATH + ' --version').read().rstrip().split('.')[0]
+
CFLAGS = [os.popen(PHPPATH + ' --includes').read().rstrip(), '-Wno-sign-compare']
LDFLAGS = os.popen(PHPPATH + ' --ldflags').read().rstrip().split()
@@ -19,7 +21,7 @@ if ld_run_path:
LDFLAGS.append('-L%s' % ld_run_path)
os.environ['LD_RUN_PATH'] = ld_run_path
-LIBS = [os.popen(PHPPATH + ' --libs').read().rstrip(), '-lphp5']
+LIBS = [os.popen(PHPPATH + ' --libs').read().rstrip(), '-lphp' + php_version]
phplibdir = os.environ.get('UWSGICONFIG_PHPLIBDIR')
if phplibdir:
--
2.6.4