From 7f8d4d642ad643f553e0fe74c0d48d59c81d178c Mon Sep 17 00:00:00 2001 From: Max Rees Date: Sun, 29 Mar 2020 03:26:16 -0500 Subject: user/libgd: [CVE] bump to 2.3.0 --- user/libgd/APKBUILD | 35 +++--- user/libgd/CVE-2016-7568.patch | 33 ------ user/libgd/CVE-2018-1000222.patch | 73 ------------- user/libgd/CVE-2018-14553.patch | 99 ----------------- user/libgd/CVE-2018-5711.patch | 61 ----------- user/libgd/CVE-2019-6977.patch | 21 ---- user/libgd/CVE-2019-6978.patch | 216 -------------------------------------- 7 files changed, 12 insertions(+), 526 deletions(-) delete mode 100644 user/libgd/CVE-2016-7568.patch delete mode 100644 user/libgd/CVE-2018-1000222.patch delete mode 100644 user/libgd/CVE-2018-14553.patch delete mode 100644 user/libgd/CVE-2018-5711.patch delete mode 100644 user/libgd/CVE-2019-6977.patch delete mode 100644 user/libgd/CVE-2019-6978.patch diff --git a/user/libgd/APKBUILD b/user/libgd/APKBUILD index 2a537dfca..c5da3861e 100644 --- a/user/libgd/APKBUILD +++ b/user/libgd/APKBUILD @@ -1,27 +1,24 @@ # Contributor: Carlo Landmeter # Maintainer: pkgname=libgd -pkgver=2.2.5 -pkgrel=2 +pkgver=2.3.0 +pkgrel=0 pkgdesc="Library for dynamic image creation" url="http://libgd.github.io/" arch="all" -options="!check" # Upstream bug 201 regression. +options="!check" # Multiple test suite failures. Assumes SSE+ math. license="MIT" depends="" makedepends="autoconf automake bash fontconfig-dev freetype-dev libjpeg-turbo-dev libpng-dev libtool libwebp-dev tiff-dev zlib-dev " +# While the fontconfig/basic test checks for what happens if an empty +# fontlist is passed to gdImageStringFT(), there still needs to be at +# least one font installed on the system... +checkdepends="ttf-liberation" subpackages="$pkgname-dev" replaces="gd" -source="https://github.com/$pkgname/$pkgname/releases/download/gd-$pkgver/$pkgname-$pkgver.tar.xz - CVE-2016-7568.patch - CVE-2018-5711.patch - CVE-2018-14553.patch - CVE-2018-1000222.patch - CVE-2019-6977.patch - CVE-2019-6978.patch - " +source="https://github.com/$pkgname/$pkgname/releases/download/gd-$pkgver/$pkgname-$pkgver.tar.xz" # secfixes: # 2.2.5-r1: @@ -31,11 +28,8 @@ source="https://github.com/$pkgname/$pkgname/releases/download/gd-$pkgver/$pkgna # - CVE-2019-6978 # 2.2.5-r2: # - CVE-2018-14553 - -prepare() { - default_prepare - autoreconf -vif -} +# 2.3.0-r0: +# - CVE-2019-11038 build() { ./configure \ @@ -61,13 +55,8 @@ dev() { default_dev depends="$pkgname perl" replaces="gd-dev" + mkdir -p "$subpkgdir"/usr/bin mv "$pkgdir"/usr/bin/bdftogd "$subpkgdir"/usr/bin } -sha512sums="e4598e17a277a75e02255402182cab139cb3f2cffcd68ec05cc10bbeaf6bc7aa39162c3445cd4a7efc1a26b72b9152bbedb187351e3ed099ea51767319997a6b libgd-2.2.5.tar.xz -8310d11a2398e8617c9defc4500b9ce3897ac1026002ffa36000f1d1f8df19336005e8c1f6587533f1d787a4a54d7a3a28ad25bddbc966a018aedf4d8704a716 CVE-2016-7568.patch -d6577566814cbe2d93b141a4216b32acdeb2989dc1712eb137565081b913151bbb4c69911c96b2bb7c90695078a85152d368aad183de494d1283fde25021751b CVE-2018-5711.patch -353491fab6c6e0916dca910c9d14f0e0efab6d9d88c48f6f3f2f69e60312489039b25d26980e7c5c2c04ed9e56003b99eae77bd412fbbed1d8eb47d561f7af74 CVE-2018-14553.patch -d12462f1b159d50b9032435e9767a5d76e1797a88be950ed33dda7aa17005b7cb60560d04b9520e46d8111e1669d42ce28cb2c508f9c8825d545ac0335d2a10b CVE-2018-1000222.patch -df84e469515f684d79ebad163e137401627310a984ac1ae6a4d31b739b3dc6d9144f101e9bfc3211af1d7cdbaa827721d21a9fe528e69b9b60a943ec8a7ab74b CVE-2019-6977.patch -3bf31941365a878bef899afa14a89e4ad0fbfb3280d34b2118c8484698e15eff600751ae3ce146a4f006e6c21730cb18899bae3538f6cc2651025274b40cf1ca CVE-2019-6978.patch" +sha512sums="5b201d22560e147a3d5471010b898ad0268c3a2453b870d1267b6ba92e540cf9f75099336c1ab08217e41827ac86fe04525726bf29ad117e5dcbaef9a8d0622a libgd-2.3.0.tar.xz" diff --git a/user/libgd/CVE-2016-7568.patch b/user/libgd/CVE-2016-7568.patch deleted file mode 100644 index 56156411e..000000000 --- a/user/libgd/CVE-2016-7568.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 2806adfdc27a94d333199345394d7c302952b95f Mon Sep 17 00:00:00 2001 -From: trylab -Date: Tue, 6 Sep 2016 18:35:32 +0800 -Subject: [PATCH] Fix integer overflow in gdImageWebpCtx - -Integer overflow can be happened in expression gdImageSX(im) * 4 * -gdImageSY(im). It could lead to heap buffer overflow in the following -code. This issue has been reported to the PHP Bug Tracking System. The -proof-of-concept file will be supplied some days later. This issue was -discovered by Ke Liu of Tencent's Xuanwu LAB. ---- - src/gd_webp.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/gd_webp.c b/src/gd_webp.c -index 8eb4dee..9886399 100644 ---- a/src/gd_webp.c -+++ b/src/gd_webp.c -@@ -199,6 +199,14 @@ BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quality) - quality = 80; - } - -+ if (overflow2(gdImageSX(im), 4)) { -+ return; -+ } -+ -+ if (overflow2(gdImageSX(im) * 4, gdImageSY(im))) { -+ return; -+ } -+ - argb = (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im)); - if (!argb) { - return; diff --git a/user/libgd/CVE-2018-1000222.patch b/user/libgd/CVE-2018-1000222.patch deleted file mode 100644 index 80f9712bf..000000000 --- a/user/libgd/CVE-2018-1000222.patch +++ /dev/null @@ -1,73 +0,0 @@ -From ac16bdf2d41724b5a65255d4c28fb0ec46bc42f5 Mon Sep 17 00:00:00 2001 -From: Mike Frysinger -Date: Sat, 14 Jul 2018 13:54:08 -0400 -Subject: [PATCH] bmp: check return value in gdImageBmpPtr - -Closes #447. ---- - src/gd_bmp.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/src/gd_bmp.c b/src/gd_bmp.c -index bde0b9d3..78f40d9a 100644 ---- a/src/gd_bmp.c -+++ b/src/gd_bmp.c -@@ -47,6 +47,8 @@ static int bmp_read_4bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp - static int bmp_read_8bit(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info, bmp_hdr_t *header); - static int bmp_read_rle(gdImagePtr im, gdIOCtxPtr infile, bmp_info_t *info); - -+static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression); -+ - #define BMP_DEBUG(s) - - static int gdBMPPutWord(gdIOCtx *out, int w) -@@ -87,8 +89,10 @@ BGD_DECLARE(void *) gdImageBmpPtr(gdImagePtr im, int *size, int compression) - void *rv; - gdIOCtx *out = gdNewDynamicCtx(2048, NULL); - if (out == NULL) return NULL; -- gdImageBmpCtx(im, out, compression); -- rv = gdDPExtractData(out, size); -+ if (!_gdImageBmpCtx(im, out, compression)) -+ rv = gdDPExtractData(out, size); -+ else -+ rv = NULL; - out->gd_free(out); - return rv; - } -@@ -141,6 +145,11 @@ BGD_DECLARE(void) gdImageBmp(gdImagePtr im, FILE *outFile, int compression) - compression - whether to apply RLE or not. - */ - BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression) -+{ -+ _gdImageBmpCtx(im, out, compression); -+} -+ -+static int _gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression) - { - int bitmap_size = 0, info_size, total_size, padding; - int i, row, xpos, pixel; -@@ -148,6 +157,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression) - unsigned char *uncompressed_row = NULL, *uncompressed_row_start = NULL; - FILE *tmpfile_for_compression = NULL; - gdIOCtxPtr out_original = NULL; -+ int ret = 1; - - /* No compression if its true colour or we don't support seek */ - if (im->trueColor) { -@@ -325,6 +335,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression) - out_original = NULL; - } - -+ ret = 0; - cleanup: - if (tmpfile_for_compression) { - #ifdef _WIN32 -@@ -338,7 +349,7 @@ BGD_DECLARE(void) gdImageBmpCtx(gdImagePtr im, gdIOCtxPtr out, int compression) - if (out_original) { - out_original->gd_free(out_original); - } -- return; -+ return ret; - } - - static int compress_row(unsigned char *row, int length) diff --git a/user/libgd/CVE-2018-14553.patch b/user/libgd/CVE-2018-14553.patch deleted file mode 100644 index 7510101d1..000000000 --- a/user/libgd/CVE-2018-14553.patch +++ /dev/null @@ -1,99 +0,0 @@ -From a93eac0e843148dc2d631c3ba80af17e9c8c860f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?F=C3=A1bio=20Cabral=20Pacheco?= -Date: Fri, 20 Dec 2019 12:03:33 -0300 -Subject: [PATCH] Fix potential NULL pointer dereference in gdImageClone() - ---- - src/gd.c | 9 +-------- - tests/gdimageclone/CMakeLists.txt | 1 + - tests/gdimageclone/Makemodule.am | 3 ++- - tests/gdimageclone/style.c | 30 ++++++++++++++++++++++++++++++ - 5 files changed, 35 insertions(+), 9 deletions(-) - create mode 100644 tests/gdimageclone/style.c - -diff --git a/src/gd.c b/src/gd.c -index 592a0286..d564d1f9 100644 ---- a/src/gd.c -+++ b/src/gd.c -@@ -2865,14 +2865,6 @@ BGD_DECLARE(gdImagePtr) gdImageClone (gdImagePtr src) { - } - } - -- if (src->styleLength > 0) { -- dst->styleLength = src->styleLength; -- dst->stylePos = src->stylePos; -- for (i = 0; i < src->styleLength; i++) { -- dst->style[i] = src->style[i]; -- } -- } -- - dst->interlace = src->interlace; - - dst->alphaBlendingFlag = src->alphaBlendingFlag; -@@ -2907,6 +2899,7 @@ BGD_DECLARE(gdImagePtr) gdImageClone (gdImagePtr src) { - - if (src->style) { - gdImageSetStyle(dst, src->style, src->styleLength); -+ dst->stylePos = src->stylePos; - } - - for (i = 0; i < gdMaxColors; i++) { -diff --git a/tests/gdimageclone/CMakeLists.txt b/tests/gdimageclone/CMakeLists.txt -index e6ccc318..662f4e96 100644 ---- a/tests/gdimageclone/CMakeLists.txt -+++ b/tests/gdimageclone/CMakeLists.txt -@@ -1,5 +1,6 @@ - LIST(APPEND TESTS_FILES - bug00300 -+ style - ) - - ADD_GD_TESTS() -diff --git a/tests/gdimageclone/Makemodule.am b/tests/gdimageclone/Makemodule.am -index 4b1b54c0..51abf5c1 100644 ---- a/tests/gdimageclone/Makemodule.am -+++ b/tests/gdimageclone/Makemodule.am -@@ -1,5 +1,6 @@ - libgd_test_programs += \ -- gdimageclone/bug00300 -+ gdimageclone/bug00300 \ -+ gdimageclone/style - - EXTRA_DIST += \ - gdimageclone/CMakeLists.txt -diff --git a/tests/gdimageclone/style.c b/tests/gdimageclone/style.c -new file mode 100644 -index 00000000..c2b246ed ---- /dev/null -+++ b/tests/gdimageclone/style.c -@@ -0,0 +1,30 @@ -+/** -+ * Cloning an image should exactly reproduce all style related data -+ */ -+ -+ -+#include -+#include "gd.h" -+#include "gdtest.h" -+ -+ -+int main() -+{ -+ gdImagePtr im, clone; -+ int style[] = {0, 0, 0}; -+ -+ im = gdImageCreate(8, 8); -+ gdImageSetStyle(im, style, sizeof(style)/sizeof(style[0])); -+ -+ clone = gdImageClone(im); -+ gdTestAssert(clone != NULL); -+ -+ gdTestAssert(clone->styleLength == im->styleLength); -+ gdTestAssert(clone->stylePos == im->stylePos); -+ gdTestAssert(!memcmp(clone->style, im->style, sizeof(style)/sizeof(style[0]))); -+ -+ gdImageDestroy(clone); -+ gdImageDestroy(im); -+ -+ return gdNumFailures(); -+} diff --git a/user/libgd/CVE-2018-5711.patch b/user/libgd/CVE-2018-5711.patch deleted file mode 100644 index dff2b9ea2..000000000 --- a/user/libgd/CVE-2018-5711.patch +++ /dev/null @@ -1,61 +0,0 @@ -From a11f47475e6443b7f32d21f2271f28f417e2ac04 Mon Sep 17 00:00:00 2001 -From: "Christoph M. Becker" -Date: Wed, 29 Nov 2017 19:37:38 +0100 -Subject: [PATCH] Fix #420: Potential infinite loop in gdImageCreateFromGifCtx - -Due to a signedness confusion in `GetCode_` a corrupt GIF file can -trigger an infinite loop. Furthermore we make sure that a GIF without -any palette entries is treated as invalid *after* open palette entries -have been removed. - -CVE-2018-5711 - -See also https://bugs.php.net/bug.php?id=75571. ---- - src/gd_gif_in.c | 12 ++++++------ - tests/gif/.gitignore | 1 + - tests/gif/CMakeLists.txt | 1 + - tests/gif/Makemodule.am | 2 ++ - tests/gif/php_bug_75571.c | 28 ++++++++++++++++++++++++++++ - tests/gif/php_bug_75571.gif | Bin 0 -> 1731 bytes - 6 files changed, 38 insertions(+), 6 deletions(-) - create mode 100644 tests/gif/php_bug_75571.c - create mode 100644 tests/gif/php_bug_75571.gif - -diff --git a/src/gd_gif_in.c b/src/gd_gif_in.c -index daf26e79..0a8bd717 100644 ---- a/src/gd_gif_in.c -+++ b/src/gd_gif_in.c -@@ -335,11 +335,6 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr fd) - return 0; - } - -- if(!im->colorsTotal) { -- gdImageDestroy(im); -- return 0; -- } -- - /* Check for open colors at the end, so - * we can reduce colorsTotal and ultimately - * BitsPerPixel */ -@@ -351,6 +346,11 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromGifCtx(gdIOCtxPtr fd) - } - } - -+ if(!im->colorsTotal) { -+ gdImageDestroy(im); -+ return 0; -+ } -+ - return im; - } - -@@ -447,7 +447,7 @@ static int - GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroDataBlockP) - { - int i, j, ret; -- unsigned char count; -+ int count; - - if(flag) { - scd->curbit = 0; diff --git a/user/libgd/CVE-2019-6977.patch b/user/libgd/CVE-2019-6977.patch deleted file mode 100644 index 4cfb9ab98..000000000 --- a/user/libgd/CVE-2019-6977.patch +++ /dev/null @@ -1,21 +0,0 @@ -Bug: https://bts.adelielinux.org/show_bug.cgi?id=159 -Backported-From: http://git.php.net/?p=php-src.git;a=commit;h=7a12dad4dd6c370835b13afae214b240082c7538 -Author: A. Wilcox -Bug: https://bugs.php.net/bug.php?id=77270 -Author: Christoph M. Becker -Committer: Stanislav Malyshev -Upstream-Status: unknown - ---- libgd-2.2.5/src/gd_color_match.c.old 2017-08-30 11:05:54.000000000 +0000 -+++ libgd-2.2.5/src/gd_color_match.c 2019-10-03 16:17:55.842322245 +0000 -@@ -31,8 +31,8 @@ - return -4; /* At least 1 color must be allocated */ - } - -- buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * im2->colorsTotal); -- memset (buf, 0, sizeof(unsigned long) * 5 * im2->colorsTotal ); -+ buf = (unsigned long *)gdMalloc(sizeof(unsigned long) * 5 * gdMaxColors); -+ memset( buf, 0, sizeof(unsigned long) * 5 * gdMaxColors ); - - for (x=0; x < im1->sx; x++) { - for( y=0; ysy; y++ ) { diff --git a/user/libgd/CVE-2019-6978.patch b/user/libgd/CVE-2019-6978.patch deleted file mode 100644 index 0cfdda919..000000000 --- a/user/libgd/CVE-2019-6978.patch +++ /dev/null @@ -1,216 +0,0 @@ -From 553702980ae89c83f2d6e254d62cf82e204956d0 Mon Sep 17 00:00:00 2001 -From: "Christoph M. Becker" -Date: Thu, 17 Jan 2019 11:54:55 +0100 -Subject: [PATCH] Fix #492: Potential double-free in gdImage*Ptr() - -Whenever `gdImage*Ptr()` calls `gdImage*Ctx()` and the latter fails, we -must not call `gdDPExtractData()`; otherwise a double-free would -happen. Since `gdImage*Ctx()` are void functions, and we can't change -that for BC reasons, we're introducing static helpers which are used -internally. - -We're adding a regression test for `gdImageJpegPtr()`, but not for -`gdImageGifPtr()` and `gdImageWbmpPtr()` since we don't know how to -trigger failure of the respective `gdImage*Ctx()` calls. - -This potential security issue has been reported by Solmaz Salimi (aka. -Rooney). ---- - src/gd_gif_out.c | 18 +++++++++++++++--- - src/gd_jpeg.c | 20 ++++++++++++++++---- - src/gd_wbmp.c | 21 ++++++++++++++++++--- - tests/jpeg/.gitignore | 1 + - tests/jpeg/CMakeLists.txt | 1 + - tests/jpeg/Makemodule.am | 3 ++- - tests/jpeg/jpeg_ptr_double_free.c | 31 +++++++++++++++++++++++++++++++ - 7 files changed, 84 insertions(+), 11 deletions(-) - create mode 100644 tests/jpeg/jpeg_ptr_double_free.c - -diff --git a/src/gd_gif_out.c b/src/gd_gif_out.c -index 298a5812..d5a95346 100644 ---- a/src/gd_gif_out.c -+++ b/src/gd_gif_out.c -@@ -99,6 +99,7 @@ static void char_init(GifCtx *ctx); - static void char_out(int c, GifCtx *ctx); - static void flush_char(GifCtx *ctx); - -+static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out); - - - -@@ -131,8 +132,11 @@ BGD_DECLARE(void *) gdImageGifPtr(gdImagePtr im, int *size) - void *rv; - gdIOCtx *out = gdNewDynamicCtx(2048, NULL); - if (out == NULL) return NULL; -- gdImageGifCtx(im, out); -- rv = gdDPExtractData(out, size); -+ if (!_gdImageGifCtx(im, out)) { -+ rv = gdDPExtractData(out, size); -+ } else { -+ rv = NULL; -+ } - out->gd_free(out); - return rv; - } -@@ -220,6 +224,12 @@ BGD_DECLARE(void) gdImageGif(gdImagePtr im, FILE *outFile) - - */ - BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) -+{ -+ _gdImageGifCtx(im, out); -+} -+ -+/* returns 0 on success, 1 on failure */ -+static int _gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) - { - gdImagePtr pim = 0, tim = im; - int interlace, BitsPerPixel; -@@ -231,7 +241,7 @@ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) - based temporary image. */ - pim = gdImageCreatePaletteFromTrueColor(im, 1, 256); - if(!pim) { -- return; -+ return 1; - } - tim = pim; - } -@@ -247,6 +257,8 @@ BGD_DECLARE(void) gdImageGifCtx(gdImagePtr im, gdIOCtxPtr out) - /* Destroy palette based temporary image. */ - gdImageDestroy( pim); - } -+ -+ return 0; - } - - -diff --git a/src/gd_jpeg.c b/src/gd_jpeg.c -index fc058420..96ef4302 100644 ---- a/src/gd_jpeg.c -+++ b/src/gd_jpeg.c -@@ -123,6 +123,8 @@ static void fatal_jpeg_error(j_common_ptr cinfo) - exit(99); - } - -+static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality); -+ - /* - * Write IM to OUTFILE as a JFIF-formatted JPEG image, using quality - * QUALITY. If QUALITY is in the range 0-100, increasing values -@@ -237,8 +239,11 @@ BGD_DECLARE(void *) gdImageJpegPtr(gdImagePtr im, int *size, int quality) - void *rv; - gdIOCtx *out = gdNewDynamicCtx(2048, NULL); - if (out == NULL) return NULL; -- gdImageJpegCtx(im, out, quality); -- rv = gdDPExtractData(out, size); -+ if (!_gdImageJpegCtx(im, out, quality)) { -+ rv = gdDPExtractData(out, size); -+ } else { -+ rv = NULL; -+ } - out->gd_free(out); - return rv; - } -@@ -259,6 +264,12 @@ void jpeg_gdIOCtx_dest(j_compress_ptr cinfo, gdIOCtx *outfile); - - */ - BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality) -+{ -+ _gdImageJpegCtx(im, outfile, quality); -+} -+ -+/* returns 0 on success, 1 on failure */ -+static int _gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality) - { - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; -@@ -293,7 +304,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality) - if(row) { - gdFree(row); - } -- return; -+ return 1; - } - - cinfo.err->emit_message = jpeg_emit_message; -@@ -334,7 +345,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality) - if(row == 0) { - gd_error("gd-jpeg: error: unable to allocate JPEG row structure: gdCalloc returns NULL\n"); - jpeg_destroy_compress(&cinfo); -- return; -+ return 1; - } - - rowptr[0] = row; -@@ -411,6 +424,7 @@ BGD_DECLARE(void) gdImageJpegCtx(gdImagePtr im, gdIOCtx *outfile, int quality) - jpeg_finish_compress(&cinfo); - jpeg_destroy_compress(&cinfo); - gdFree(row); -+ return 0; - } - - -diff --git a/src/gd_wbmp.c b/src/gd_wbmp.c -index f19a1c96..a49bdbec 100644 ---- a/src/gd_wbmp.c -+++ b/src/gd_wbmp.c -@@ -88,6 +88,8 @@ int gd_getin(void *in) - return (gdGetC((gdIOCtx *)in)); - } - -+static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out); -+ - /* - Function: gdImageWBMPCtx - -@@ -100,6 +102,12 @@ int gd_getin(void *in) - out - the stream where to write - */ - BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out) -+{ -+ _gdImageWBMPCtx(image, fg, out); -+} -+ -+/* returns 0 on success, 1 on failure */ -+static int _gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out) - { - int x, y, pos; - Wbmp *wbmp; -@@ -107,7 +115,7 @@ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out) - /* create the WBMP */ - if((wbmp = createwbmp(gdImageSX(image), gdImageSY(image), WBMP_WHITE)) == NULL) { - gd_error("Could not create WBMP\n"); -- return; -+ return 1; - } - - /* fill up the WBMP structure */ -@@ -123,11 +131,15 @@ BGD_DECLARE(void) gdImageWBMPCtx(gdImagePtr image, int fg, gdIOCtx *out) - - /* write the WBMP to a gd file descriptor */ - if(writewbmp(wbmp, &gd_putout, out)) { -+ freewbmp(wbmp); - gd_error("Could not save WBMP\n"); -+ return 1; - } - - /* des submitted this bugfix: gdFree the memory. */ - freewbmp(wbmp); -+ -+ return 0; - } - - /* -@@ -271,8 +283,11 @@ BGD_DECLARE(void *) gdImageWBMPPtr(gdImagePtr im, int *size, int fg) - void *rv; - gdIOCtx *out = gdNewDynamicCtx(2048, NULL); - if (out == NULL) return NULL; -- gdImageWBMPCtx(im, fg, out); -- rv = gdDPExtractData(out, size); -+ if (!_gdImageWBMPCtx(im, fg, out)) { -+ rv = gdDPExtractData(out, size); -+ } else { -+ rv = NULL; -+ } - out->gd_free(out); - return rv; - } -- cgit v1.2.3-70-g09d2 From 1898956d4fb51404a527e909230781848a9d3118 Mon Sep 17 00:00:00 2001 From: Max Rees Date: Wed, 25 Mar 2020 07:26:01 +0000 Subject: user/php7: bump to 7.4.4 * Use system libgd * Use system oniguruma * Upstream has migrated from pcre to pcre2 * Drop comments about extensions that aren't being built (imap, recode, sodium, tidy) * Drop php7-wddx (has been removed from core upstream) * Drop php7-litespeed (I don't think anyone uses this) * Pin subpackage versions to main package * Fix _extensions_by_load_order so all extensions are tested * This increases the test suite size from ~ 9000 to ~ 15000 * Add additional API/ABI checks from Fedora --- user/php7/APKBUILD | 437 ++++++++++++++++++------------------ user/php7/disabled-tests.list | 87 ++++++- user/php7/enchant-2.patch | 64 +++--- user/php7/fix-tests-devserver.patch | 23 -- user/php7/getsockopt.patch | 37 +++ user/php7/install-pear.patch | 7 +- user/php7/no-max-ent-size.patch | 257 +++++++++++++++++++++ user/php7/pwbuflen.patch | 15 -- user/php7/test-fixes.patch | 71 ++++++ user/php7/zend_bool.patch | 19 ++ user/php7/zip-glob-pathc.patch | 15 ++ 11 files changed, 733 insertions(+), 299 deletions(-) delete mode 100644 user/php7/fix-tests-devserver.patch create mode 100644 user/php7/getsockopt.patch create mode 100644 user/php7/no-max-ent-size.patch delete mode 100644 user/php7/pwbuflen.patch create mode 100644 user/php7/test-fixes.patch create mode 100644 user/php7/zend_bool.patch create mode 100644 user/php7/zip-glob-pathc.patch diff --git a/user/php7/APKBUILD b/user/php7/APKBUILD index a8ef4976e..581104a84 100644 --- a/user/php7/APKBUILD +++ b/user/php7/APKBUILD @@ -8,10 +8,10 @@ # ----------+---------+------------------------+--------- # bcmath | LGPL2 | ext/bcmath/libbcmath | used # date | MIT | ext/date/lib | used -# gd | BSD | ext/gd/libgd | used +# gd | BSD | ext/gd/libgd | not used # file | BSD | ext/fileinfo/libmagic | used # libmbfl | LGPLv2 | ext/mbstring/libmbfl | used -# oniguruma | BSD | ext/mbstring/oniguruma | used +# oniguruma | BSD | ext/mbstring/oniguruma | not used # pcre | BSD | ext/pcre/pcrelib | not used # sqlite3 | Public | ext/sqlite3/libsqlite | not used # libzip | BSD | ext/zip/lib | not used @@ -25,63 +25,68 @@ pkgname=php7 _pkgname=php -pkgver=7.2.21 +pkgver=7.4.4 pkgrel=0 -_apiver=20170718 +_apiver=20190902 +_zendver=20190902 +_pdover=20170320 pkgdesc="The PHP7 language runtime engine" url="https://php.net/" arch="all" license="PHP-3.01 AND Zend-2.0 AND Custom:TSRM AND LGPL-2.1+ AND MIT AND Beerware AND Public-Domain AND BSD-3-Clause AND Apache-1.0 AND PostgreSQL AND BSD-2-Clause AND Zlib AND BSD-4-Clause" depends="" depends_dev="$pkgname=$pkgver-r$pkgrel autoconf icu-dev libedit-dev libxml2-dev - pcre-dev zlib-dev" + pcre2-dev zlib-dev" makedepends="autoconf apache-httpd-dev aspell-dev + automake bison bzip2-dev + cmd:which curl-dev db-dev enchant-dev freetds-dev - freetype-dev gdbm-dev gettext-tiny gmp-dev icu-dev krb5-dev libedit-dev + libgd-dev libical-dev - libjpeg-turbo-dev - libpng-dev openssl-dev - libwebp-dev libxml2-dev - libxpm-dev libxslt-dev libzip-dev net-snmp-dev + oniguruma-dev openldap-dev - pcre-dev + pcre2-dev postgresql-dev re2c sqlite-dev unixodbc-dev - zlib-dev" -subpackages="$pkgname-dev $pkgname-doc $pkgname-apache $pkgname-phpdbg - $pkgname-embed $pkgname-litespeed $pkgname-cgi $pkgname-fpm + zlib-dev + " +subpackages="$pkgname-dev $pkgname-doc $pkgname-phpdbg + $pkgname-embed $pkgname-cgi $pkgname-fpm $pkgname-apache $pkgname-pear::noarch $pkgname-dbg" source="https://www.php.net/distributions/$_pkgname-$pkgver.tar.bz2 $_pkgname-fpm.initd $_pkgname-fpm.logrotate $_pkgname-module.conf disabled-tests.list - install-pear.patch + enchant-2.patch fpm-paths.patch - allow-build-recode-and-imap-together.patch - fix-tests-devserver.patch - pwbuflen.patch - enchant-2.patch" + getsockopt.patch + install-pear.patch + no-max-ent-size.patch + test-fixes.patch + zend_bool.patch + zip-glob-pathc.patch + " builddir="$srcdir/$_pkgname-$pkgver" _libdir="/usr/lib/$_pkgname" _extension_dir="$_libdir/modules" @@ -105,137 +110,133 @@ _extension_confd="/etc/$_pkgname/conf.d" # 7.2.21-r0: # - CVE-2019-11041 # - CVE-2019-11042 - -# Usage: add_ext [with|enable] name [extension dependencies...] [configure options...] -add_ext() { - local ext="$1" +# 7.4.4-r0: +# - CVE-2019-11043 +# - CVE-2019-11045 +# - CVE-2019-11046 +# - CVE-2019-11047 +# - CVE-2019-11050 +# - CVE-2019-13224 +# - CVE-2020-7059 +# - CVE-2020-7060 +# - CVE-2020-7062 +# - CVE-2020-7063 +# - CVE-2020-7064 +# - CVE-2020-7066 + +# Usage: _add_ext [with|enable] name [extension dependencies...] [configure options...] +_add_ext() { + _ext="$1" shift - # add_ext [with|enable] name -> --[with|enable]-name=shared - if [ "$ext" = "with" ] || [ "$ext" = "enable" ]; then - _configure_ext_opts="$_configure_ext_opts --$ext-$1=shared" - ext="$1" + # _add_ext [with|enable] name -> --[with|enable]-name=shared + case "$_ext" in + with|enable) + _configure_ext_opts="$_configure_ext_opts --$_ext-$1=shared" + _ext="$1" shift - fi + ;; + esac - case "$ext" in - phar) subpackages="$subpackages $pkgname-$ext:$ext";; - *) subpackages="$subpackages $pkgname-$ext:_extension";; + case "$_ext" in + phar) subpackages="$subpackages $pkgname-$_ext:$_ext";; + *) subpackages="$subpackages $pkgname-$_ext:_extension";; esac - _extensions="$_extensions $ext" + _extensions="$_extensions $_ext" - local opt - local prev - for opt in $@; do - case "$opt" in + for _opt; do + case "$_opt" in -*) # Add more configure options - _configure_ext_opts="$_configure_ext_opts $opt" + _configure_ext_opts="$_configure_ext_opts $_opt" ;; license:*) # Add custom license - opt="$(printf '%s' "${opt#license:}" | sed 's/:/ AND /g')" - eval "_licenses_$ext='$opt'" + _opt="$(printf '%s' "${_opt#license:}" | sed 's/:/ AND /g')" + eval "_licenses_$_ext='$_opt'" ;; *) # Add dependencies - prev="$(eval echo \$_deps_$ext)" - eval "_deps_$ext='$prev $opt'" + eval "_deps_$_ext=\"\$_deps_$_ext $_opt\"" ;; - esac + esac done } -enable_ext() { add_ext enable $@; } -with_ext() { add_ext with $@; } +_enable_ext() { _add_ext enable "$@"; } +_with_ext() { _add_ext with "$@"; } -enable_ext 'bcmath' \ +_enable_ext bcmath \ license:LGPL-2.0+:PHP-3.01 -with_ext 'bz2' -enable_ext 'calendar' -enable_ext 'ctype' -with_ext 'curl' -enable_ext 'dba' \ +_with_ext bz2 +_enable_ext calendar +_enable_ext ctype +_with_ext curl +_enable_ext dba \ --with-db4 \ --with-dbmaker=shared \ --with-gdbm -enable_ext 'dom' -with_ext 'enchant' -enable_ext 'exif' mbstring -enable_ext 'fileinfo' \ +_enable_ext dom +_with_ext enchant +_enable_ext exif mbstring +_enable_ext fileinfo \ license:PHP-3.0:BSD-2-Clause:BSD-3-Clause:Public-Domain -enable_ext 'ftp' -with_ext 'gd' \ - --with-freetype-dir=/usr \ - --disable-gd-jis-conv \ - --with-jpeg-dir=/usr \ - --with-png-dir=/usr \ - --with-webp-dir=/usr \ - --with-xpm-dir=/usr -with_ext 'gettext' -with_ext 'gmp' -with_ext 'iconv' -# Needs makedepeneds=imap-dev -#with_ext 'imap' \ -# --with-imap-ssl -enable_ext 'intl' -enable_ext 'json' -with_ext 'ldap' \ +_enable_ext ftp +_enable_ext gd \ + --with-external-gd +_with_ext gettext +_with_ext gmp +_with_ext iconv +_enable_ext intl +_enable_ext json +_with_ext ldap \ --with-ldap-sasl -enable_ext 'mbstring' \ +_enable_ext mbstring \ license:PHP-3.01:OLDAP-2.8:BSD-2-Clause:Public-Domain:LGPL-2.0-only:LGPL-2.1-only -add_ext 'mysqli' mysqlnd openssl \ +_add_ext mysqli mysqlnd openssl \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=/run/mysqld/mysqld.sock -enable_ext 'mysqlnd' openssl -add_ext 'odbc' \ +_enable_ext mysqlnd openssl +_add_ext odbc \ --with-unixODBC=shared,/usr -enable_ext 'opcache' -with_ext 'openssl' \ +_enable_ext opcache +_with_ext openssl \ --with-system-ciphers \ --with-kerberos -enable_ext 'pcntl' -enable_ext 'pdo' -add_ext 'pdo_dblib' pdo \ +_enable_ext pcntl +_enable_ext pdo +_add_ext pdo_dblib pdo \ --with-pdo-dblib=shared -add_ext 'pdo_mysql' pdo mysqlnd \ +_add_ext pdo_mysql pdo mysqlnd \ --with-pdo-mysql=shared,mysqlnd -add_ext 'pdo_odbc' pdo \ +_add_ext pdo_odbc pdo \ license:PHP-3.0 \ --with-pdo-odbc=shared,unixODBC,/usr -add_ext 'pdo_pgsql' pdo \ +_add_ext pdo_pgsql pdo \ --with-pdo-pgsql=shared -add_ext 'pdo_sqlite' pdo \ +_add_ext pdo_sqlite pdo \ --with-pdo-sqlite=shared,/usr -with_ext 'pgsql' -enable_ext 'phar' -enable_ext 'posix' -with_ext 'pspell' -# Needs makedepends=recode-dev -#with_ext 'recode' -enable_ext 'session' -enable_ext 'shmop' -enable_ext 'simplexml' -with_ext 'snmp' -enable_ext 'soap' \ +_with_ext pgsql +_enable_ext phar +_enable_ext posix +_with_ext pspell +_enable_ext session +_enable_ext shmop +_enable_ext simplexml +_with_ext snmp +_enable_ext soap \ license:PHP-3.01:PHP-2.02 -# Needs makedepends=libsodium-dev -#with_ext 'sodium' -enable_ext 'sockets' -add_ext 'sqlite3' \ +_enable_ext sockets +_add_ext sqlite3 \ --with-sqlite3=shared,/usr -enable_ext 'sysvmsg' -enable_ext 'sysvsem' -enable_ext 'sysvshm' -# Needs makedepends=tidyhtml-dev -#with_ext 'tidy' -enable_ext 'tokenizer' -enable_ext 'wddx' xml -enable_ext 'xml' -enable_ext 'xmlreader' dom -with_ext 'xmlrpc' xml -enable_ext 'xmlwriter' -with_ext 'xsl' dom -enable_ext 'zip' \ - --with-libzip=/usr +_enable_ext sysvmsg +_enable_ext sysvsem +_enable_ext sysvshm +_enable_ext tokenizer +_enable_ext xml +_enable_ext xmlreader dom +_with_ext xmlrpc xml +_enable_ext xmlwriter +_with_ext xsl dom +_with_ext zip # secfixes: # 7.2.5-r0: @@ -248,13 +249,23 @@ enable_ext 'zip' \ prepare() { default_prepare - update_config_sub - local vapi="$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)" - if [ "$vapi" != "$_apiver" ]; then - error "Upstreram API version is now $vapi. Expecting $_apiver" - error "After updating _apiver, all 3rd-party extensions must be rebuilt." - return 1 + _vapi="$(sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h)" + if [ "$_vapi" != "$_apiver" ]; then + error "Upstream API version $_vapi != $_apiver" + die "All third-party extensions must be rebuilt" + fi + + _zapi="$(sed -n '/#define ZEND_MODULE_API_NO/{s/^[^0-9]*//;p;}' Zend/zend_modules.h)" + if [ "$_zapi" != "$_zendver" ]; then + error "Upstream Zend API version $_zapi != $_zendver" + die "All third-party extensions must be rebuilt" + fi + + _papi="$(sed -n '/#define PDO_DRIVER_API/{s/.*[ ]//;p}' ext/pdo/php_pdo_driver.h)" + if [ "$_papi" != "$_pdover" ]; then + error "Upstream PDO API version $_papi != $_pdover" + die "All third-party extensions must be rebuilt" fi # https://bugs.php.net/63362 - Not needed but installed headers. @@ -271,21 +282,17 @@ prepare() { # Fix some bogus permissions. find . -name '*.[ch]' -exec chmod 644 {} + - # XXX: Delete failing tests. - sed -n '/^[^#]/p' "$srcdir/disabled-tests.list" | while read item; do - rm $item + # XXX: Disable failing tests. + sed -n '/^[^#]/p' "$srcdir/disabled-tests.list" | while read _test; do + mv "$_test" "${_test}d" done autoconf } -# Notes: -# * gd-jis-conv breaks any non-latin font rendering (vakartel). -# * libxml cannot be build as shared. -# * Doesn't work with system-provided onigurama, some tests fail (invalid code -# point); probably because bundled onigurama is version 5.x, but we have 6.x. _build() { - EXTENSION_DIR=$_extension_dir PCRE_INCDIR="/usr/include" ./configure \ + # libxml cannot be build as shared. + EXTENSION_DIR="$_extension_dir" ./configure \ --build=$CBUILD \ --host=$CHOST \ --prefix=/usr \ @@ -301,56 +308,61 @@ _build() { --with-config-file-path=/etc/$_pkgname \ --with-config-file-scan-dir=$_extension_confd \ --disable-short-tags \ - --with-icu-dir=/usr \ --with-libedit \ --without-readline \ - --enable-libxml \ - --with-libxml-dir=/usr \ - --with-pcre-regex=/ \ + --with-external-pcre \ --with-zlib \ --with-zlib-dir=/usr \ $_configure_ext_opts \ - $@ + "$@" make } build() { - # phpdbg - _build --enable-phpdbg \ - --enable-phpdbg-webhelper \ - --disable-cgi \ - --disable-cli + export CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-pointer-sign" # apache-httpd module - _build --disable-phpdbg \ + _build --disable-fpm \ + --disable-embed \ + --disable-phpdbg \ --disable-cgi \ --disable-cli \ --with-apxs2 mv libs/libphp7.so sapi/apache2handler/mod_php.so - # cgi, cli, fpm, embed, litespeed - _build --disable-phpdbg \ - --enable-fpm \ - --enable-embed \ - --with-litespeed + _build --enable-fpm=yes \ + --enable-embed=yes \ + --enable-phpdbg=yes \ + --enable-phpdbg-webhelper=yes } check() { # PHP is so stupid that it's not able to resolve dependencies # between extensions and load them in correct order, so we must # help it... - # opcache is Zend extension, it's handled specially in Makefile - local php_modules="$(_extensions_by_load_order \ - | grep -vx opcache \ - | xargs -n 1 printf "'$builddir/modules/%s.la' ")" - sed -i "/^PHP_TEST_SHARED_EXTENSIONS/,/extension=/ \ - s|in \$(PHP_MODULES)\"*|in $php_modules|" Makefile + # + # * opcache is Zend extension, it's handled specially in Makefile + # * skip pdo_dblib since it slowly tries to connect to nonexistent + # * ditto snmp + + cat > php-check.ini <<-EOF + extension_dir=$builddir/modules + $(_extensions_by_load_order \ + | grep -vxe opcache -e pdo_dblib -e snmp \ + | sed -e 's/^/extension=/' -e 's/$/.so/') + EOF + + # Note: We use the combination of PHPRC=... and + # PHP_MODULES=(nothing) so we can set the module load order + # correctly. Cf. test-fixes.patch NO_INTERACTION=1 REPORT_EXIT_STATUS=1 \ SKIP_SLOW_TESTS=1 SKIP_ONLINE_TESTS=1 TEST_TIMEOUT=10 \ + TEST_PHP_ARGS="-j$JOBS -W test.log" \ TZ= LANG= LC_ALL= \ - make test + PHPRC="$builddir"/php-check.ini \ + make test PHP_MODULES= echo 'NOTE: We have skipped quite a lot tests, see disabled-tests.list.' } @@ -376,14 +388,13 @@ doc() { cd "$builddir" mkdir -p "$subpkgdir/usr/share/doc/$_pkgname" - cp CODING_STANDARDS CREDITS EXTENSIONS INSTALL LICENSE NEWS \ - README* UPGRADING* \ + cp EXTENSIONS LICENSE NEWS README* UPGRADING* \ "$subpkgdir/usr/share/doc/$_pkgname/" } apache() { pkgdesc="PHP7 Module for apache-httpd" - depends="$pkgname apache-httpd" + depends="$pkgname=$pkgver-r$pkgrel apache-httpd" install -D -m 755 "$builddir"/sapi/apache2handler/mod_php.so \ "$subpkgdir"/usr/libexec/apache2/mod_php.so @@ -393,37 +404,26 @@ apache() { phpdbg() { pkgdesc="Interactive PHP7 debugger" - #depends="$pkgname" ? - install -Dm755 "$builddir"/sapi/phpdbg/phpdbg \ - "$subpkgdir"/usr/bin/phpdbg + _mv "$pkgdir"/usr/bin/phpdbg "$subpkgdir"/usr/bin/ } embed() { pkgdesc="PHP7 Embedded Library" - #depends="$pkgname" ? _mv "$pkgdir"/usr/lib/libphp*.so "$subpkgdir"/usr/lib/ } -litespeed() { - pkgdesc="PHP7 LiteSpeed SAPI" - #depends="$pkgname" ? - - mkdir -p "$subpkgdir"/usr/bin - mv "$pkgdir"/usr/bin/lsphp "$subpkgdir"/usr/bin -} - cgi() { pkgdesc="PHP7 Common Gateway Interface" - depends="$pkgname" + depends="$pkgname=$pkgver-r$pkgrel" _mv "$pkgdir"/usr/bin/php-cgi "$subpkgdir"/usr/bin/ } fpm() { pkgdesc="PHP7 FastCGI Process Manager" - depends="$pkgname" + depends="$pkgname=$pkgver-r$pkgrel" cd "$pkgdir" _mv var "$subpkgdir"/ @@ -431,9 +431,9 @@ fpm() { _mv usr/sbin "$subpkgdir"/usr/ _mv etc/$_pkgname/php-fpm* "$subpkgdir"/etc/$_pkgname/ - local file; for file in php-fpm.conf php-fpm.d/www.conf; do - mv "$subpkgdir"/etc/$_pkgname/$file.default \ - "$subpkgdir"/etc/$_pkgname/$file + for _file in php-fpm.conf php-fpm.d/www.conf; do + mv "$subpkgdir/etc/$_pkgname/$_file.default" \ + "$subpkgdir/etc/$_pkgname/$_file" done install -D -m 755 "$srcdir"/$_pkgname-fpm.initd \ @@ -447,7 +447,7 @@ fpm() { pear() { pkgdesc="PHP7 Extension and Application Repository" - depends="$pkgname $pkgname-xml" + depends="$pkgname=$pkgver-r$pkgrel $pkgname-xml=$pkgver-r$pkgrel" cd "$pkgdir" # pecl needs xml extension and since we build it as shared, it must be @@ -455,8 +455,8 @@ pear() { sed -i 's/\$INCARG/& -d extension=xml.so/' usr/bin/pecl mkdir -p "$subpkgdir"/usr/bin - local file; for file in pecl pear peardev; do - mv usr/bin/$file "$subpkgdir"/usr/bin/$file + for _file in pecl pear peardev; do + mv "usr/bin/$_file" "$subpkgdir/usr/bin/$_file" done _mv etc/php/pear.conf "$subpkgdir"/etc/php/ @@ -475,73 +475,70 @@ phar() { } _extension() { - local ext="${subpkgname#$pkgname-}" - local extdesc="$(head -n1 "$builddir"/ext/$ext/CREDITS 2>/dev/null ||:)" - depends="$pkgname" - local dep; for dep in $(eval echo \$_deps_$ext); do - depends="$depends $pkgname-$dep" + _ext="${subpkgname#$pkgname-}" + + depends="$pkgname=$pkgver-r$pkgrel" + for _dep in $(eval echo \$_deps_$_ext); do + depends="$depends $pkgname-$_dep=$pkgver-r$pkgrel" done - pkgdesc="PHP7 extension: ${extdesc:-$ext}" - if [ -n "$(eval echo \$_licenses_$ext)" ]; then - license="$(eval echo \$_licenses_$ext)" - fi - local load_order=$(_extension_load_order "$ext") + pkgdesc="$(head -n1 "$builddir/_ext/$_ext/CREDITS" 2>/dev/null ||:)" + pkgdesc="PHP7 extension: ${pkgdesc:-$_ext}" - # extension prefix - local prefix= - [ "$ext" = "opcache" ] && prefix="zend_" + if [ -n "$(eval echo \$_licenses_$_ext)" ]; then + license="$(eval echo \$_licenses_$_ext)" + fi - _mv "$pkgdir"/$_extension_dir/$ext.so \ - "$subpkgdir"/$_extension_dir/ + _mv "$pkgdir/$_extension_dir/$_ext.so" \ + "$subpkgdir/$_extension_dir/" - mkdir -p "$subpkgdir"/$_extension_confd - echo "${prefix}extension=$ext.so" \ - > "$subpkgdir"/$_extension_confd/$(printf %02d $load_order)_$ext.ini + _load_order="$(printf %02d "$(_extension_load_order "$_ext")")" + case "$_ext" in + opcache) _prefix=zend_;; + *) _prefix=;; + esac + mkdir -p "$subpkgdir/$_extension_confd" + cat > "$subpkgdir/$_extension_confd/${_load_order}_$_ext.ini" <<-EOF + ${_prefix}extension=$_ext.so + EOF } # Prints a load order (0-based integer) for the given extension name. Extension # with lower load order should be loaded before exts with higher load order. -# It's based on number of dependencies of the extension (with exception for -# "imap"), which is flawed, but simple and good enough for now. +# It's based on number of dependencies of the extension which is flawed, +# but simple and good enough for now. _extension_load_order() { - local ext="$1" - local deps="$(eval echo \$_deps_$ext)" - - case "$ext" in - # This must be loaded after recode, even though it does - # not depend on it. - imap) echo 1;; - # depends=$pkgname - phar) echo 1;; - *) echo "$deps" | wc -w;; + _ext="$1" + case "$_ext" in + # depends=$pkgname + phar) echo 1;; + *) echo "$(eval echo \$_deps_$_ext)" | wc -w;; esac } # Prints $_extensions sorted by load order and name. _extensions_by_load_order() { - local deps list ext - - for ext in $_extensions; do - list="$list $(_extension_load_order $ext);$ext" - done - printf '%s\n' $list | sort -t ';' -k 1 | sed -E 's/\d+;//' + for _ext in $_extensions; do + printf '%s\n' "$(_extension_load_order $_ext);$_ext" + done | sort -t ';' -k 1 | sed -E 's/[0-9]+;//' } _mv() { - local dest; for dest; do true; done # get last argument - mkdir -p "$dest" - mv $@ + for _dest; do true; done # get last argument + mkdir -p "$_dest" + mv "$@" } -sha512sums="b234305f04bd621d355450ba38b34558a5b08403571749ac3b04ffa60d7639e847750109bef09a14f616110ba175b970d68cbae0d0b671c2dfeac6917f12f21d php-7.2.21.tar.bz2 +sha512sums="5676023858ffbef4997c2ed99ce1689de2b56d09a0925b8fc6527d56e7f6031b380e433e417e44f84196e713d84c16b33212ed6d116b5c347d1d60586288c248 php-7.4.4.tar.bz2 cb3ba48fbd412f12d98ef1f88b509b40bc4ca44a16779a06d43e4db3cb8d24d54404b9e11ca941b5339af8d3281ca9c8ea3ba5ced4339f91fb40608b5ce9a647 php-fpm.initd 01d4ba3ef104ea378eb0e8cbb7bdee3fdf65e4bd6865eb3bc6c0dc4af31c2d52887abdf0150b5ef984b877860285a3b1af84b11ffebb5b8b722ea9faf83edfeb php-fpm.logrotate a7f9ba5e11652fd1cb9e756c3269269a95de083ecb5be936a85c7a09c1396db9088e0251c6a643c40235c0e776fce2a471e5c7f5a033b85c7d3b3110c2b39e48 php-module.conf -b1008eabc86fcff88336fe2961e3229c159c930a05d97359136c381c5c1cc572a33110308a3e5ef5e31c60327f76c9ef02b375cd2ea8ff9caa7deeddc216f4ce disabled-tests.list -f1177cbf6b1f44402f421c3d317aab1a2a40d0b1209c11519c1158df337c8945f3a313d689c939768584f3e4edbe52e8bd6103fb6777462326a9d94e8ab1f505 install-pear.patch +587057aaf93feec2936e2851dbb42ba78310fc012e340d90c58a8912437a8b6a15585895490c31ac31cf36969ea1f2999993c5ca42031c378f31fb83d361fd73 disabled-tests.list +2fb8e1dce0e71a968c53869b01369bb681e4e043e87d342cd96cb7c09e8c2ca0aad9752d8e0781de54488bee54717ba0de5ef9eba28f16cd7e6b914e03c53bc6 enchant-2.patch a77dd3bdf9dc7a0f2c06ff3e7c425d062bbaa29902c17402ce98701dc99499be863ad543aa5e6a7d1c249702d6afb193398dd3199ae58e42b32b95d434fb1883 fpm-paths.patch -f8ecae241a90cbc3e98aa4deb3d5d35ef555f51380e29f4e182a8060dffeb84be74f030a14c6b452668471030d78964f52795ca74275db05543ccad20ef1f2cc allow-build-recode-and-imap-together.patch -f8bb322e56df79dd9f391737fb8737945cc730b14c7dc2ae8688979c565a9b97f5f2a12c9fcd0d8124624a9d09bd10228147d9e999bb94909bbe249f0a50646c fix-tests-devserver.patch -8e538063d872f6770a57cdb844226a771ccda3d387dd1f199bb08c274b94fbe12ec0ef6df75c32071f308cb8f4ab51b91b520c7c2ed687adf96d0d322788e463 pwbuflen.patch -03de56676449ddc1ba1fc9c4fee2b2ed620cd1a8ce52d288c91b42e081182871ade55c8dbbe1c8286bc4eadcd92d497a62ac7b689ea8d6b1bcb5eb25225595c4 enchant-2.patch" +821bf6fde83302e7613429a61066e2bd3ca4e998dcb7c11e39f4ae84829056537501b47a051e1feba752f72d98644b9a214633db9ccb16d137d3242d145acfe0 getsockopt.patch +951fa8445c20513aa48bf7c7d773c6b4012322e7e7592c13d965758e761b9898c484f0dbc5ae565c05787e6ab868769c97c71504624b10c9570e1d4214f75b10 install-pear.patch +5fd358dfd660901c8ffdaffe0bce398ab020f8c1beb89e26ba1b21646212fe132927d52ae088220d0b9c53017cfc67f4c9b88f7602df61d36eba5768ce94e355 no-max-ent-size.patch +9160e5c6b8bf2d87299f38421caf498519eb42243118570754a5764b5e682c546309548e76df6163df49e841ff51fb07e50fadeed1687da5d73dec1810c393ee test-fixes.patch +0cd6b8739533511c0d1edcb1ecff4d8d21a6b51d21f77c382645cf31d1645eeb2ebd80e2720557ceefa58f538385e097402bdc50e613dc7699bd8f033aefa543 zend_bool.patch +1b22dfa547bd1e14e065966f5268adda771c4ad039b83acee30772cd95f0f0b1a320d75fc6ab71a0bc6ca5ce04d58d9f410767c4fae4d5e16537393c78439f21 zip-glob-pathc.patch" diff --git a/user/php7/disabled-tests.list b/user/php7/disabled-tests.list index 10117801e..fc1386e2e 100644 --- a/user/php7/disabled-tests.list +++ b/user/php7/disabled-tests.list @@ -1,18 +1,14 @@ # Dumb failures # Expects permissions on /etc to be 40755 ext/standard/tests/file/006_error.phpt -# session_start() missing - needs session.so -# Test manually using the following: -# test.ini contains "extension=./modules/session.so" -# TEST_PHP_EXECUTABLE=sapi/cli/php sapi/cli/php run-tests.php -c test.ini $f -Zend/tests/unset_cv05.phpt -Zend/tests/unset_cv06.phpt # Tests undefined behavior (integer underflow or overflow) Zend/tests/dval_to_lval_32.phpt Zend/tests/int_underflow_32bit.phpt ext/date/tests/bug53437_var3.phpt ext/date/tests/bug53437_var5.phpt ext/date/tests/bug53437_var6.phpt +ext/exif/tests/bug79046.phpt +ext/exif/tests/float_cast_overflow.phpt # General glibc/musl incompatibility related failures # stdout printed in wrong order @@ -25,10 +21,17 @@ ext/standard/tests/strings/007.phpt ext/standard/tests/file/popen_pclose_error.phpt # "Address in use" instead of "Address already in use" printed for EADDRINUSE sapi/fpm/tests/socket-ipv4-fallback.phpt +# strerror differences +ext/sockets/tests/socket_strerror.phpt +ext/sockets/tests/socket_create_pair-wrongparams.phpt +# socket_addrinfo_explain has unexpected ai_canonname member +ext/sockets/tests/socket_addrinfo_explain.phpt # locale related failures # LC_NUMERIC unsupported ext/standard/tests/strings/sprintf_f_3.phpt +ext/intl/tests/bug67052.phpt +ext/json/tests/bug41403.phpt tests/lang/034.phpt tests/lang/bug30638.phpt # LC_ALL unsupported @@ -43,8 +46,10 @@ ext/standard/tests/strings/htmlentities03.phpt ext/standard/tests/strings/htmlentities04.phpt ext/standard/tests/strings/htmlentities15.phpt ext/standard/tests/strings/strtoupper.phpt +ext/fileinfo/tests/bug74170.phpt # LC_MONETARY unsupported ext/standard/tests/strings/moneyformat.phpt +ext/soap/tests/bugs/bug39815.phpt # locale: command not found ext/standard/tests/strings/setlocale_basic1.phpt ext/standard/tests/strings/setlocale_basic2.phpt @@ -53,6 +58,17 @@ ext/standard/tests/strings/setlocale_variation1.phpt ext/standard/tests/strings/setlocale_variation2.phpt # setlocale allows "en_US.invalid" ext/standard/tests/strings/setlocale_error.phpt +# bind_textdomain_codeset is a stub +ext/gettext/tests/gettext_bind_textdomain_codeset-retval.phpt +# //IGNORE +ext/iconv/tests/bug48147.phpt +ext/iconv/tests/bug76249.phpt +# //TRANSLIT +ext/iconv/tests/iconv_basic_001.phpt +# misc musl iconv incompatibilities +ext/iconv/tests/bug52211.phpt +ext/iconv/tests/eucjp2iso2022jp.phpt +ext/iconv/tests/iconv_mime_encode.phpt # strftime and strptime related failures # strftime %Z (timezone abbreviation) returns a single space @@ -91,5 +107,64 @@ ext/standard/tests/crypt/des_fallback_invalid_salt.phpt #sapi/fpm/tests/015.phpt # Times out on builders but runs fine manually +ext/zlib/tests/bug67724.phpt ext/zlib/tests/inflate_add_basic.phpt sapi/cli/tests/upload_2G.phpt + +# gd errors more verbose than expected +ext/gd/tests/bug39780_extern.phpt +ext/gd/tests/bug45799.phpt +ext/gd/tests/bug77973.phpt +ext/gd/tests/createfromwbmp2_extern.phpt +ext/gd/tests/libgd00086_extern.phpt + +# no XPM support in system gd +ext/gd/tests/xpm2gd.phpt +ext/gd/tests/xpm2jpg.phpt +ext/gd/tests/xpm2png.phpt + +# misc differences when using system gd +ext/gd/tests/bug43073.phpt +ext/gd/tests/bug48732-mb.phpt +ext/gd/tests/bug48732.phpt +ext/gd/tests/bug48801-mb.phpt +ext/gd/tests/bug48801.phpt +ext/gd/tests/bug53504.phpt +ext/gd/tests/bug65148.phpt +ext/gd/tests/bug73272.phpt +ext/gd/tests/bug73869.phpt +ext/gd/tests/bug79067.phpt +ext/gd/tests/bug79068.phpt + +# requires a default route to be set, which isn't the case during +# network isolation +ext/sockets/tests/bug63000.phpt + +# This should be skipped like long_columns.phpt is but it's missing the +# additional checks +ext/pdo_odbc/tests/max_columns.phpt + +# enchant-2 doesn't support enchant_broker_(get|set)_dict_path +# https://news-web.php.net/php.internals/100882 +ext/enchant/tests/bug53070.phpt + +# Warning: zend_signal: handler was replaced +ext/readline/tests/libedit_callback_handler_install_001.phpt +ext/readline/tests/libedit_callback_handler_remove_001.phpt + +# soap server's sum is not accumulating +ext/soap/tests/server009.phpt + +# "Resource bundle source files are compiled with the genrb tool into a +# binary runtime form (.res files) that is portable among platforms with +# the same charset family (ASCII vs. EBCDIC) and **endianness**." +# +# Therefore these tests which use little-endian .res files will not work +# on our big endian arches... +ext/intl/tests/resourcebundle_arrayaccess.phpt +ext/intl/tests/resourcebundle_countable.phpt +ext/intl/tests/resourcebundle_create.phpt +ext/intl/tests/resourcebundle_individual.phpt +ext/intl/tests/resourcebundle_iterator.phpt +ext/intl/tests/resourcebundle_locales.phpt +ext/intl/tests/resourcebundle_traversable.phpt diff --git a/user/php7/enchant-2.patch b/user/php7/enchant-2.patch index ed048de28..709345cf0 100644 --- a/user/php7/enchant-2.patch +++ b/user/php7/enchant-2.patch @@ -1,31 +1,33 @@ -Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enchant-2.patch?h=packages/php - ---- php-7.1.13/ext/enchant/config.m4.orig 2018-01-03 02:32:29.000000000 +0000 -+++ php-7.1.13/ext/enchant/config.m4 2018-01-21 22:10:03.788875780 +0000 -@@ -14,9 +14,9 @@ - ENCHANT_SEARCH_DIRS="/usr/local /usr" - fi - for i in $ENCHANT_SEARCH_DIRS; do -- if test -f $i/include/enchant/enchant.h; then -+ if test -f $i/include/enchant-2/enchant.h; then - ENCHANT_DIR=$i -- ENCHANT_INCDIR=$i/include/enchant -+ ENCHANT_INCDIR=$i/include/enchant-2 - elif test -f $i/include/enchant.h; then - ENCHANT_DIR=$i - ENCHANT_INCDIR=$i/include -@@ -31,7 +31,7 @@ - - AC_DEFINE(HAVE_ENCHANT,1,[ ]) - PHP_SUBST(ENCHANT_SHARED_LIBADD) -- PHP_ADD_LIBRARY_WITH_PATH(enchant, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD) -+ PHP_ADD_LIBRARY_WITH_PATH(enchant-2, $ENCHANT_LIBDIR, ENCHANT_SHARED_LIBADD) - PHP_ADD_INCLUDE($ENCHANT_INCDIR) - PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param, - [ ---- php-7.2.1/ext/enchant/enchant.c.orig 2018-01-02 22:36:05.000000000 +0000 -+++ php-7.2.1/ext/enchant/enchant.c 2018-01-21 22:34:50.205791491 +0000 -@@ -741,7 +741,7 @@ +--- php-7.4.4/ext/enchant/config.m4 2020-03-17 10:40:22.000000000 +0000 ++++ php-7.4.4/ext/enchant/config.m4 2020-03-27 21:25:27.754470703 +0000 +@@ -4,21 +4,21 @@ PHP_ARG_WITH([enchant], + [Include Enchant support])]) + + if test "$PHP_ENCHANT" != "no"; then +- PKG_CHECK_MODULES([ENCHANT], [enchant]) ++ PKG_CHECK_MODULES([ENCHANT], [enchant-2]) + + PHP_EVAL_INCLINE($ENCHANT_CFLAGS) + PHP_EVAL_LIBLINE($ENCHANT_LIBS, ENCHANT_SHARED_LIBADD) + + AC_DEFINE(HAVE_ENCHANT, 1, [ ]) + +- PHP_CHECK_LIBRARY(enchant, enchant_get_version, ++ PHP_CHECK_LIBRARY(enchant-2, enchant_get_version, + [ + AC_DEFINE(HAVE_ENCHANT_GET_VERSION, 1, [ ]) + ], [ ], [ + $ENCHANT_LIBS + ]) + +- PHP_CHECK_LIBRARY(enchant, enchant_broker_set_param, ++ PHP_CHECK_LIBRARY(enchant-2, enchant_broker_set_param, + [ + AC_DEFINE(HAVE_ENCHANT_BROKER_SET_PARAM, 1, [ ]) + ], [ ], [ +--- a/ext/enchant/enchant.c.orig ++++ b/ext/enchant/enchant.c +@@ -738,7 +738,7 @@ for (i = 0; i < n_sugg; i++) { add_next_index_string(sugg, suggs[i]); } @@ -34,7 +36,7 @@ Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enc } -@@ -798,7 +798,7 @@ +@@ -793,7 +793,7 @@ add_next_index_string(return_value, suggs[i]); } @@ -43,7 +45,7 @@ Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enc } } /* }}} */ -@@ -818,7 +818,7 @@ +@@ -813,7 +813,7 @@ PHP_ENCHANT_GET_DICT; @@ -52,7 +54,7 @@ Lifted from Arch: https://git.archlinux.org/svntogit/packages.git/tree/trunk/enc } /* }}} */ -@@ -856,7 +856,7 @@ +@@ -851,7 +851,7 @@ PHP_ENCHANT_GET_DICT; diff --git a/user/php7/fix-tests-devserver.patch b/user/php7/fix-tests-devserver.patch deleted file mode 100644 index 80a72f0f1..000000000 --- a/user/php7/fix-tests-devserver.patch +++ /dev/null @@ -1,23 +0,0 @@ -From: Jakub Jirutka -Date: Mon, 01 May 2017 01:33:00 +0200 -Subject: [PATCH] Fix tests failing due to extra message from built-in web server - -Remove messages like: - - PHP 7.1.4 Development Server started at Mon May 1 00:42:39 2017 - -from test outputs, because tests do not expect them. I have no clue what -happens here... - ---- a/run-tests.php -+++ b/run-tests.php -@@ -2005,6 +2005,9 @@ - // Does the output match what is expected? - $output = preg_replace("/\r\n/", "\n", trim($out)); - -+ // Remove message from built-in development server. -+ $output = preg_replace("/^PHP [0-9.]+ Development Server started at .*\n\n?/m", "", $output); -+ - /* when using CGI, strip the headers from the output */ - $headers = array(); - diff --git a/user/php7/getsockopt.patch b/user/php7/getsockopt.patch new file mode 100644 index 000000000..81f2bc232 --- /dev/null +++ b/user/php7/getsockopt.patch @@ -0,0 +1,37 @@ +Socket options with level IPPROTO_IP and IPPROTO_IPV6 cannot be handled +in the same switch statement as options with level SOL_SOCKET since +there may be collisions in their numerical values. + +For example, on ppc64: + +* IPV6_MULTICAST_HOPS and SO_RCVTIMEO are both 18 +* IPV6_MULTICAST_LOOP and SO_SNDTIMEO are both 19 + +etc. + +--- php-7.4.4/ext/sockets/sockets.c 2020-03-17 06:40:21.000000000 -0400 ++++ php-7.4.4/ext/sockets/sockets.c 2020-03-29 22:39:57.506751737 -0400 +@@ -2008,6 +2008,7 @@ PHP_FUNCTION(socket_get_option) + } + } + } ++ goto handle_default; + } + #if HAVE_IPV6 + else if (level == IPPROTO_IPV6) { +@@ -2017,6 +2018,7 @@ PHP_FUNCTION(socket_get_option) + } else if (ret == FAILURE) { + RETURN_FALSE; + } /* else continue */ ++ goto handle_default; + } + #endif + +@@ -2063,6 +2065,7 @@ PHP_FUNCTION(socket_get_option) + break; + + default: ++ handle_default: + optlen = sizeof(other_val); + + if (getsockopt(php_sock->bsd_socket, level, optname, (char*)&other_val, &optlen) != 0) { diff --git a/user/php7/install-pear.patch b/user/php7/install-pear.patch index 18747be94..8f5fb3444 100644 --- a/user/php7/install-pear.patch +++ b/user/php7/install-pear.patch @@ -1,7 +1,6 @@ ---- ./pear/Makefile.frag.orig 2013-04-12 07:02:27.041602514 +0000 -+++ ./pear/Makefile.frag 2013-04-12 07:04:09.065836822 +0000 -@@ -2,8 +2,11 @@ - +--- php-7.4.4/pear/Makefile.frag 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/pear/Makefile.frag 2020-03-25 03:57:55.940744663 +0000 +@@ -1,7 +1,10 @@ peardir=$(PEAR_INSTALLDIR) +# help the built php to find xml extension so we can install pear diff --git a/user/php7/no-max-ent-size.patch b/user/php7/no-max-ent-size.patch new file mode 100644 index 000000000..7f28ba3f1 --- /dev/null +++ b/user/php7/no-max-ent-size.patch @@ -0,0 +1,257 @@ +--- php-7.4.4/ext/posix/posix.c 2020-03-17 10:40:22.000000000 +0000 ++++ php-7.4.4/ext/posix/posix.c 2020-03-27 03:19:13.133440186 +0000 +@@ -1084,8 +1084,11 @@ PHP_FUNCTION(posix_getgrnam) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + + #if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) ++ errno = 0; + buflen = sysconf(_SC_GETGR_R_SIZE_MAX); +- if (buflen < 1) { ++ if (buflen == -1 && errno == 0) { ++ buflen = 1024; ++ } else if (buflen < 1) { + RETURN_FALSE; + } + buf = emalloc(buflen); +@@ -1127,9 +1130,7 @@ PHP_FUNCTION(posix_getgrgid) + { + zend_long gid; + #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) +- int ret; + struct group _g; +- struct group *retgrptr = NULL; + long grbuflen; + char *grbuf; + #endif +@@ -1141,20 +1142,27 @@ PHP_FUNCTION(posix_getgrgid) + + #if defined(ZTS) && defined(HAVE_GETGRGID_R) && defined(_SC_GETGR_R_SIZE_MAX) + ++ errno = 0; + grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX); +- if (grbuflen < 1) { ++ if (grbuflen == -1 && errno == 0) { ++ grbuflen = 1024; ++ } else if (grbuflen < 1) { + RETURN_FALSE; + } +- + grbuf = emalloc(grbuflen); ++try_again: ++ g = &_g; + +- ret = getgrgid_r(gid, &_g, grbuf, grbuflen, &retgrptr); +- if (ret || retgrptr == NULL) { +- POSIX_G(last_error) = ret; ++ if (getgrgid_r(gid, g, grbuf, grbuflen, &g) || g == NULL) { ++ if (errno == ERANGE) { ++ grbuflen *= 2; ++ grbuf = erealloc(grbuf, grbuflen); ++ goto try_again; ++ } ++ POSIX_G(last_error) = errno; + efree(grbuf); + RETURN_FALSE; + } +- g = &_g; + #else + if (NULL == (g = getgrgid(gid))) { + POSIX_G(last_error) = errno; +@@ -1210,14 +1218,23 @@ PHP_FUNCTION(posix_getpwnam) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) ++ errno = 0; + buflen = sysconf(_SC_GETPW_R_SIZE_MAX); +- if (buflen < 1) { ++ if (buflen == -1 && errno == 0) { ++ buflen = 1024; ++ } else if (buflen < 1) { + RETURN_FALSE; + } + buf = emalloc(buflen); ++try_again: + pw = &pwbuf; + + if (getpwnam_r(name, pw, buf, buflen, &pw) || pw == NULL) { ++ if (errno == ERANGE) { ++ buflen *= 2; ++ buf = erealloc(buf, buflen); ++ goto try_again; ++ } + efree(buf); + POSIX_G(last_error) = errno; + RETURN_FALSE; +@@ -1248,10 +1265,8 @@ PHP_FUNCTION(posix_getpwuid) + zend_long uid; + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) + struct passwd _pw; +- struct passwd *retpwptr = NULL; + long pwbuflen; + char *pwbuf; +- int ret; + #endif + struct passwd *pw; + +@@ -1260,19 +1275,27 @@ PHP_FUNCTION(posix_getpwuid) + ZEND_PARSE_PARAMETERS_END_EX(RETURN_FALSE); + + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWUID_R) ++ errno = 0; + pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + RETURN_FALSE; + } + pwbuf = emalloc(pwbuflen); ++try_again: ++ pw = &_pw; + +- ret = getpwuid_r(uid, &_pw, pwbuf, pwbuflen, &retpwptr); +- if (ret || retpwptr == NULL) { +- POSIX_G(last_error) = ret; ++ if (getpwuid_r(uid, pw, pwbuf, pwbuflen, &pw) || pw == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } ++ POSIX_G(last_error) = errno; + efree(pwbuf); + RETURN_FALSE; + } +- pw = &_pw; + #else + if (NULL == (pw = getpwuid(uid))) { + POSIX_G(last_error) = errno; +--- php-7.4.4/ext/standard/filestat.c 2020-03-17 10:40:30.000000000 +0000 ++++ php-7.4.4/ext/standard/filestat.c 2020-03-27 04:00:18.333479165 +0000 +@@ -302,15 +302,25 @@ PHPAPI int php_get_gid_by_name(const cha + #if defined(ZTS) && defined(HAVE_GETGRNAM_R) && defined(_SC_GETGR_R_SIZE_MAX) + struct group gr; + struct group *retgrptr; ++ errno = 0; + long grbuflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char *grbuf; + +- if (grbuflen < 1) { ++ if (grbuflen == -1 && errno == 0) { ++ grbuflen = 1024; ++ } else if (grbuflen < 1) { + return FAILURE; + } + + grbuf = emalloc(grbuflen); +- if (getgrnam_r(name, &gr, grbuf, grbuflen, &retgrptr) != 0 || retgrptr == NULL) { ++try_again: ++ retgrptr = &gr; ++ if (getgrnam_r(name, &gr, grbuf, grbuflen, &retgrptr) || retgrptr == NULL) { ++ if (errno == ERANGE) { ++ grbuflen *= 2; ++ grbuf = erealloc(grbuf, grbuflen); ++ goto try_again; ++ } + efree(grbuf); + return FAILURE; + } +@@ -438,15 +448,25 @@ PHPAPI uid_t php_get_uid_by_name(const c + #if defined(ZTS) && defined(_SC_GETPW_R_SIZE_MAX) && defined(HAVE_GETPWNAM_R) + struct passwd pw; + struct passwd *retpwptr = NULL; ++ errno = 0; + long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + return FAILURE; + } + + pwbuf = emalloc(pwbuflen); +- if (getpwnam_r(name, &pw, pwbuf, pwbuflen, &retpwptr) != 0 || retpwptr == NULL) { ++try_again: ++ retpwptr = &pw; ++ if (getpwnam_r(name, &pw, pwbuf, pwbuflen, &retpwptr) || retpwptr == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } + efree(pwbuf); + return FAILURE; + } +--- php-7.4.4/main/fopen_wrappers.c 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/main/fopen_wrappers.c 2020-03-27 04:08:46.553487201 +0000 +@@ -366,10 +366,13 @@ PHPAPI int php_fopen_primary_script(zend + struct passwd *pw; + #if defined(ZTS) && defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX) + struct passwd pwstruc; ++ errno = 0; + long pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + return FAILURE; + } + +@@ -382,7 +385,14 @@ PHPAPI int php_fopen_primary_script(zend + memcpy(user, path_info + 2, length); + user[length] = '\0'; + #if defined(ZTS) && defined(HAVE_GETPWNAM_R) && defined(_SC_GETPW_R_SIZE_MAX) +- if (getpwnam_r(user, &pwstruc, pwbuf, pwbuflen, &pw)) { ++try_again: ++ pw = &pwstruc; ++ if (getpwnam_r(user, pw, pwbuf, pwbuflen, &pw) || pw == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } + efree(pwbuf); + return FAILURE; + } +--- php-7.4.4/main/main.c 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/main/main.c 2020-03-27 03:33:22.663453619 +0000 +@@ -1487,23 +1487,27 @@ PHPAPI char *php_get_current_user(void) + struct passwd *pwd; + #if defined(ZTS) && defined(HAVE_GETPWUID_R) && defined(_SC_GETPW_R_SIZE_MAX) + struct passwd _pw; +- struct passwd *retpwptr = NULL; ++ errno = 0; + int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char *pwbuf; + +- if (pwbuflen < 1) { ++ if (pwbuflen == -1 && errno == 0) { ++ pwbuflen = 1024; ++ } else if (pwbuflen < 1) { + return ""; + } + pwbuf = emalloc(pwbuflen); +- if (getpwuid_r(pstat->st_uid, &_pw, pwbuf, pwbuflen, &retpwptr) != 0) { +- efree(pwbuf); +- return ""; +- } +- if (retpwptr == NULL) { ++try_again: ++ pwd = &_pw; ++ if (getpwuid_r(pstat->st_uid, pwd, pwbuf, pwbuflen, &pwd) || pwd == NULL) { ++ if (errno == ERANGE) { ++ pwbuflen *= 2; ++ pwbuf = erealloc(pwbuf, pwbuflen); ++ goto try_again; ++ } + efree(pwbuf); + return ""; + } +- pwd = &_pw; + #else + if ((pwd=getpwuid(pstat->st_uid))==NULL) { + return ""; diff --git a/user/php7/pwbuflen.patch b/user/php7/pwbuflen.patch deleted file mode 100644 index 7d2685b55..000000000 --- a/user/php7/pwbuflen.patch +++ /dev/null @@ -1,15 +0,0 @@ -sysconf(_SC_GETPW_R_SIZE_MAX) returns -1 on musl and 1024 on glibc. - ---- php-7.2.6/main/main.c 2018-06-04 23:30:18.790089810 -0400 -+++ php-7.2.6/main/main.c 2018-06-04 23:30:14.660089806 -0400 -@@ -1315,7 +1315,9 @@ - int pwbuflen = sysconf(_SC_GETPW_R_SIZE_MAX); - char *pwbuf; - -- if (pwbuflen < 1) { -+ if (pwbuflen == -1) { -+ pwbuflen = 1024; -+ } else if (pwbuflen < 1) { - return ""; - } - pwbuf = emalloc(pwbuflen); diff --git a/user/php7/test-fixes.patch b/user/php7/test-fixes.patch new file mode 100644 index 000000000..976783d77 --- /dev/null +++ b/user/php7/test-fixes.patch @@ -0,0 +1,71 @@ +Don't filter out "extension=" settings from INI files during check() so +we can inject our own module load order. + +--- php-7.4.4/build/Makefile.global 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/build/Makefile.global 2020-03-27 06:11:09.713603308 +0000 +@@ -83,7 +83,7 @@ PHP_TEST_SHARED_EXTENSIONS = ` \ + . $$i; $(top_srcdir)/build/shtool echo -n -- " -d zend_extension=$(top_builddir)/modules/$$dlname"; \ + done; \ + fi` +-PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?|(zend_)?extension(_debug)?(_ts)?)[\t\ ]*=' ++PHP_DEPRECATED_DIRECTIVES_REGEX = '^(magic_quotes_(gpc|runtime|sybase)?)[\t\ ]*=' + + test: all + @if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \ + + + + +Likewise, make sure these settings are honored for these tests. + +--- php-7.4.4/ext/opcache/tests/php_cli_server.inc 2020-03-17 10:40:23.000000000 +0000 ++++ php-7.4.4/ext/opcache/tests/php_cli_server.inc 2020-03-27 22:36:13.054537829 +0000 +@@ -11,7 +11,7 @@ function php_cli_server_start($ini = "") + $ini_array = array_map(function($arg) { + return trim($arg, '\'"'); + }, $ini_array); +- $cmd = [$php_executable, '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS]; ++ $cmd = [$php_executable, '-d', 'extension_dir='.ini_get('extension_dir'), '-t', $doc_root, '-n', ...$ini_array, '-S', PHP_CLI_SERVER_ADDRESS]; + $descriptorspec = array( + 0 => STDIN, + 1 => STDOUT, +--- php-7.4.4/ext/session/tests/session_regenerate_id_cookie.phpt 2020-03-17 10:40:28.000000000 +0000 ++++ php-7.4.4/ext/session/tests/session_regenerate_id_cookie.phpt 2020-03-27 06:43:24.043633893 +0000 +@@ -56,7 +56,7 @@ var_dump(session_destroy()); + ob_end_flush(); + ?>'); + +-var_dump(`$php -n -d session.name=PHPSESSID $file`); ++var_dump(`$php -c php-check.ini -d session.name=PHPSESSID $file`); + + unlink($file); + +--- php-7.4.4/ext/soap/tests/bug73037.phpt 2020-03-17 10:40:24.000000000 +0000 ++++ php-7.4.4/ext/soap/tests/bug73037.phpt 2020-03-27 23:02:05.964562383 +0000 +@@ -63,8 +63,7 @@ function get_data($max) + } + + $router = "bug73037_server.php"; +-$args = substr(PHP_OS, 0, 3) == 'WIN' +- ? ["-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=php_soap.dll"] : []; ++$args = ["-d", "extension_dir=" . ini_get("extension_dir"), "-d", "extension=soap.so"]; + $code = <<<'PHP' + $s = new SoapServer(NULL, array('uri' => 'http://here')); + $s->setObject(new stdclass()); + + + +Don't include useless message on startup which will break every test. + +--- php-7.4.4/run-tests.php 2020-03-17 10:40:21.000000000 +0000 ++++ php-7.4.4/run-tests.php 2020-03-25 04:01:26.320747990 +0000 +@@ -2503,6 +2503,9 @@ COMMAND $cmd + // Does the output match what is expected? + $output = preg_replace("/\r\n/", "\n", trim($out)); + ++ // Remove message from built-in development server. ++ $output = preg_replace("/^PHP [0-9.]+ Development Server started at .*\n\n?/m", "", $output); ++ + /* when using CGI, strip the headers from the output */ + $headers = array(); + diff --git a/user/php7/zend_bool.patch b/user/php7/zend_bool.patch new file mode 100644 index 000000000..b2e0b0f8f --- /dev/null +++ b/user/php7/zend_bool.patch @@ -0,0 +1,19 @@ +zend_parse_parameters can't be passed &int if it's expecting zend_bool +("b", unsigned char). + +Ironically, this code (Reflect::export) is scheduled to be removed in +the next 7.4 release[1], so don't bother forwarding. + +[1] https://github.com/php/php-src/pull/5188 + +--- php-7.4.4/ext/reflection/php_reflection.c 2020-03-17 06:40:26.000000000 -0400 ++++ php-7.4.4/ext/reflection/php_reflection.c 2020-03-30 01:00:27.938405046 -0400 +@@ -1304,7 +1304,7 @@ static void _reflection_export(INTERNAL_ + zval *argument_ptr, *argument2_ptr; + zval retval, params[2]; + int result; +- int return_output = 0; ++ zend_bool return_output = 0; + zend_fcall_info fci; + zend_fcall_info_cache fcc; + diff --git a/user/php7/zip-glob-pathc.patch b/user/php7/zip-glob-pathc.patch new file mode 100644 index 000000000..74b81754a --- /dev/null +++ b/user/php7/zip-glob-pathc.patch @@ -0,0 +1,15 @@ +Upstream: https://github.com/php/php-src/pull/5311 + +--- php-7.4.4/ext/zip/php_zip.c 2020-03-17 10:40:30.000000000 +0000 ++++ php-7.4.4/ext/zip/php_zip.c 2020-03-27 15:28:13.259857804 -0500 +@@ -606,8 +606,9 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v + add_next_index_string(return_value, globbuf.gl_pathv[n]+cwd_skip); + } + ++ ret = globbuf.gl_pathc; + globfree(&globbuf); +- return globbuf.gl_pathc; ++ return ret; + #else + zend_throw_error(NULL, "Glob support is not available"); + return 0; -- cgit v1.2.3-70-g09d2 From 1c09cdc63882d2c110a6b71ef600c9b18b29bcfb Mon Sep 17 00:00:00 2001 From: Max Rees Date: Mon, 17 Feb 2020 21:45:56 -0600 Subject: user/php7-apcu: bump to 5.1.18, fix module loading --- user/php7-apcu/APKBUILD | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/user/php7-apcu/APKBUILD b/user/php7-apcu/APKBUILD index e9ad17ae4..94f95e03f 100644 --- a/user/php7-apcu/APKBUILD +++ b/user/php7-apcu/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Max Rees pkgname=php7-apcu _pkgname=${pkgname#php7-} -pkgver=5.1.17 +pkgver=5.1.18 pkgrel=0 pkgdesc="Userland cache for PHP" url="https://pecl.php.net/package/APCu" @@ -34,6 +34,9 @@ check() { package() { # It didn't listen to DESTDIR make INSTALL_ROOT="$pkgdir" install + + install -d "$pkgdir"/etc/php/conf.d/ + echo 'extension=apcu.so' > "$pkgdir"/etc/php/conf.d/00_apcu.ini } -sha512sums="7f6a6cd927ed4ff251497c2c79e8d832d1a44ddd59abdb175886d3c12ea27f26142e6b851ac5bb5acb49a0e3a998e9741ba0ff03310f51b9cd188cdf6cf12793 apcu-5.1.17.tgz" +sha512sums="5e9c5b4540be7abdf2f473d2f8955d8708934a1d6e05cb2c99154cc7ba8a2bbf9afde51769e20f46ef278efd6f60b9172e0864c31e0976b9d3096a337035e7a9 apcu-5.1.18.tgz" -- cgit v1.2.3-70-g09d2 From f917a65d0b4f357f0e16794cf9ccf032873781db Mon Sep 17 00:00:00 2001 From: Max Rees Date: Sun, 5 Apr 2020 12:20:21 +0000 Subject: user/uwsgi: rebuild for PHP 7.4 --- user/uwsgi/APKBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/uwsgi/APKBUILD b/user/uwsgi/APKBUILD index 97cacd829..a8f216aa3 100644 --- a/user/uwsgi/APKBUILD +++ b/user/uwsgi/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: A. Wilcox pkgname=uwsgi pkgver=2.0.18 -pkgrel=1 +pkgrel=2 pkgdesc="Web application server" url="https://projects.unbit.it/uwsgi" arch="all" -- cgit v1.2.3-70-g09d2 From af409aaaaf71ee25115f59e64bf8ea566d278176 Mon Sep 17 00:00:00 2001 From: Max Rees Date: Sun, 5 Apr 2020 12:45:41 +0000 Subject: user/perl-gd: rebuild for libgd --- user/perl-gd/APKBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user/perl-gd/APKBUILD b/user/perl-gd/APKBUILD index 6ac163fb6..df76050da 100644 --- a/user/perl-gd/APKBUILD +++ b/user/perl-gd/APKBUILD @@ -6,7 +6,7 @@ _author=RURBAN _au=${_author%%"${_author#??}"} _a=${_author%%"${_author#?}"} pkgver=2.71 -pkgrel=0 +pkgrel=1 pkgdesc="Perl module for GD graphics library" url="https://metacpan.org/release/GD" arch="all" -- cgit v1.2.3-70-g09d2