~ruther/guix-local

0bef0ac46ec70e437daeea471563fbba7ac27acc — Efraim Flashner 2 years ago d15ffea
gnu: php: Update to 8.2.13.

* gnu/packages/php.scm (php): Update to 8.2.13.
[source]: Remove patch.
[arguments]: Adjust the 'prepare-tests phase to skip fewer tests.
[inputs]: Replace openssl-1.1 with openssl.
* gnu/packages/patches/php-fix-streams-copy-length.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Remove it.

Change-Id: I29892deda457fdbaa6dd5e01515e97583951836d
3 files changed, 8 insertions(+), 148 deletions(-)

M gnu/local.mk
D gnu/packages/patches/php-fix-streams-copy-length.patch
M gnu/packages/php.scm
M gnu/local.mk => gnu/local.mk +0 -1
@@ 1750,7 1750,6 @@ dist_patch_DATA =						\
  %D%/packages/patches/pango-skip-libthai-test.patch		\
  %D%/packages/patches/password-store-tree-compat.patch		\
  %D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch			\
  %D%/packages/patches/php-fix-streams-copy-length.patch	\
  %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
  %D%/packages/patches/pocketfft-cpp-prefer-preprocessor-if.patch			\
  %D%/packages/patches/pokerth-boost.patch			\

D gnu/packages/patches/php-fix-streams-copy-length.patch => gnu/packages/patches/php-fix-streams-copy-length.patch +0 -52
@@ 1,52 0,0 @@
From cddcc10becb013ae498ea9c2836792f407b61678 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Tue, 7 Feb 2023 22:55:59 +0100
Subject: [PATCH] Fix file corruption when using copy_file_range.

This patch is adapted from https://github.com/php/php-src/pull/10440.
---
 main/streams/streams.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/main/streams/streams.c b/main/streams/streams.c
index 20029fc7..68dc76c5 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -1634,8 +1634,21 @@ PHPAPI zend_result _php_stream_copy_to_stream_ex(php_stream *src, php_stream *de
 		char *p;
 
 		do {
-			size_t chunk_size = (maxlen == 0 || maxlen > PHP_STREAM_MMAP_MAX) ? PHP_STREAM_MMAP_MAX : maxlen;
-			size_t mapped;
+            /* We must not modify maxlen here, because otherwise the file copy fallback below can fail */
+            size_t chunk_size, must_read, mapped;
+            if (maxlen == 0) {
+				/* Unlimited read */
+				must_read = chunk_size = PHP_STREAM_MMAP_MAX;
+			} else {
+				must_read = maxlen - haveread;
+				if (must_read >= PHP_STREAM_MMAP_MAX) {
+					chunk_size = PHP_STREAM_MMAP_MAX;
+				} else {
+					/* In case the length we still have to read from the file could be smaller than the file size,
+					 * chunk_size must not get bigger the size we're trying to read. */
+					chunk_size = must_read;
+				}
+			}
 
 			p = php_stream_mmap_range(src, php_stream_tell(src), chunk_size, PHP_STREAM_MAP_MODE_SHARED_READONLY, &mapped);
 
@@ -1667,8 +1680,8 @@ PHPAPI zend_result _php_stream_copy_to_stream_ex(php_stream *src, php_stream *de
 					return SUCCESS;
 				}
 				if (maxlen != 0) {
-					maxlen -= mapped;
-					if (maxlen == 0) {
+					must_read -= mapped;
+					if (must_read == 0) {
 						return SUCCESS;
 					}
 				}
-- 
2.38.1


M gnu/packages/php.scm => gnu/packages/php.scm +8 -95
@@ 5,7 5,7 @@
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2021 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2021, 2023 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2023 Timo Wilken <guix@twilken.net>
;;;
;;; This file is part of GNU Guix.


@@ 62,7 62,7 @@
(define-public php
  (package
    (name "php")
    (version "8.2.2")
    (version "8.2.13")
    (home-page "https://www.php.net/")
    (source (origin
              (method url-fetch)


@@ 70,9 70,7 @@
                                  "php-" version ".tar.xz"))
              (sha256
               (base32
                "0czflx9ikxymjfgnzaifjx9kc30ww2x4063075hcifjjwqwami5x"))
              (patches
               (search-patches "php-fix-streams-copy-length.patch"))
                "0js5bm8r3kngsgmxhyr681vrpl4gib3318k8428pigqp06hvna96"))
              (modules '((guix build utils)))
              (snippet
               '(with-directory-excursion "ext"


@@ 233,42 231,11 @@
                       '("ext/posix/tests/posix_getgrgid.phpt"    ; Requires /etc/group.
                         "ext/posix/tests/posix_getgrnam_basic.phpt" ; Requires /etc/group.
                         "ext/sockets/tests/bug63000.phpt"        ; Fails to detect OS.
                         "ext/sockets/tests/socket_shutdown.phpt" ; Requires DNS.
                         "ext/sockets/tests/socket_send.phpt"     ; Likewise.
                         "ext/sockets/tests/mcast_ipv4_recv.phpt" ; Requires multicast.
                         ;; These needs /etc/services.
                         "ext/standard/tests/general_functions/getservbyname_basic.phpt"
                         "ext/standard/tests/general_functions/getservbyport_basic.phpt"
                         "ext/standard/tests/general_functions/getservbyport_variation1.phpt"
                         ;; And /etc/protocols.
                         "ext/standard/tests/network/getprotobyname_basic.phpt"
                         "ext/standard/tests/network/getprotobynumber_basic.phpt"
                         ;; And exotic locales.
                         ;; These need exotic locales.
                         "ext/standard/tests/strings/setlocale_basic1.phpt"
                         "ext/standard/tests/strings/setlocale_basic2.phpt"
                         "ext/standard/tests/strings/setlocale_basic3.phpt"
                         "ext/standard/tests/strings/setlocale_variation1.phpt"
                         ;; This failing test is skipped on PHP's Travis CI as it is
                         ;; supposedly inaccurate.
                         "ext/standard/tests/file/disk_free_space_basic.phpt"
                         ;; The following test erroneously expect the link
                         ;; count of a sub-directory to increase compared to
                         ;; its parent.
                         "ext/standard/tests/file/lstat_stat_variation8.phpt"
                         ;; This tests whether microseconds ‘differ enough’ and
                         ;; fails inconsistently on ‘fast’ machines.
                         "ext/date/tests/bug73837.phpt"

                         ;; XXX: These gd tests fails.  Likely because our version
                         ;; is different from the (patched) bundled one.
                         ;; Here, gd quits immediately after "fatal libpng error"; while the
                         ;; test expects it to additionally return a "setjmp" error and warning.
                         "ext/gd/tests/bug39780_extern.phpt"
                         "ext/gd/tests/libgd00086_extern.phpt"
                         ;; Extra newline in gd-png output.
                         "ext/gd/tests/bug45799.phpt"
                         ;; Test expects generic "gd warning" but gets the actual function name.
                         "ext/gd/tests/createfromwbmp2_extern.phpt"
                         ;; This bug should have been fixed in gd 2.2.2.
                         ;; Is it a regression?
                         "ext/gd/tests/bug65148.phpt"


@@ 291,47 258,15 @@
                         "ext/gd/tests/xpm2gd.phpt"
                         "ext/gd/tests/xpm2jpg.phpt"
                         "ext/gd/tests/xpm2png.phpt"
                         ;; Whitespace difference, probably caused by a very
                         ;; long store path
                         "ext/gd/tests/bug77479.phpt"
                         ;; Expected invalid XBM but got EOF before image was
                         ;; complete.  It's a warning in both cases and test
                         ;; result is the same.
                         "ext/gd/tests/bug77973.phpt"
                         ;; Test expects uninitialized value to be false, but
                         ;; instead gets "resource(5) of type (gd)".
                         "ext/gd/tests/bug79067.phpt"
                         ;; The following test fails with "The image size
                         ;; differs: expected 114x115, got 117x117".
                         "ext/gd/tests/bug79068.phpt"
                         ;; AVIF support disabled
                         "ext/gd/tests/avif_decode_encode.phpt"
                         ;; Typo in expected outputs
                         "ext/gd/tests/bug72339.phpt"
                         "ext/gd/tests/bug77272.phpt"
                         "ext/gd/tests/bug66356.phpt"
                         ;; AVIF support disabled
                         "ext/gd/tests/imagecreatefromstring_avif.phpt"

                         ;; XXX: These iconv tests have the expected outcome,
                         ;; but with different error messages.
                         ;; Expects "illegal character", instead gets "unknown error (84)".
                         "ext/iconv/tests/bug52211.phpt"
                         "ext/iconv/tests/bug60494.phpt"
                         ;; Expects "wrong charset", gets unknown error (22).
                         "ext/iconv/tests/iconv_strlen_error2.phpt"
                         "ext/iconv/tests/iconv_substr_error2.phpt"
                         ;; Expects conversion error, gets "error condition Termsig=11".
                         "ext/iconv/tests/iconv_strpos_error2.phpt"
                         "ext/iconv/tests/iconv_strrpos_error2.phpt"
                         ;; Expects "invalid multibyte sequence" but got
                         ;; "unknown error".
                         "ext/iconv/tests/bug76249.phpt"

                         ;; XXX: These test failures appear legitimate, needs investigation.
                         ;; open_basedir() restriction failure.
                         "ext/curl/tests/bug61948-unix.phpt"
                         ;; Same error reason but error code slightly different
                         "ext/curl/tests/curl_setopt_ssl.phpt"

                         ;; Fail because there is no "root" in the build container's


@@ 340,11 275,6 @@
                         "sapi/fpm/tests/bug68591-conf-test-listen-group.phpt"
                         "sapi/fpm/tests/bug68591-conf-test-listen-owner.phpt"

                         ;; Wrong error name
                         "ext/dba/tests/dba_gdbm_creation_matrix.phpt"
                         ;; Expects a false boolean, gets empty array from glob().
                         "ext/standard/tests/file/bug41655_1.phpt"
                         "ext/standard/tests/file/glob_variation5.phpt"
                         ;; The test expects an Array, but instead get the contents(?).
                         "ext/gd/tests/bug43073.phpt"
                         ;; imagettftext() returns wrong coordinates.


@@ 357,26 287,9 @@
                         "ext/gd/tests/bug53504.phpt"
                         ;; Wrong image size after scaling an image.
                         "ext/gd/tests/bug73272.phpt"
                         ;; Expects iconv to detect illegal characters, instead gets
                         ;; "unknown error (84)" and heap corruption(!).
                         "ext/iconv/tests/bug48147.phpt"
                         ;; Expects illegal character ".", gets "=?utf-8?Q?."
                         "ext/iconv/tests/bug51250.phpt"
                         ;; iconv throws "buffer length exceeded" on some string checks.
                         "ext/iconv/tests/iconv_mime_encode.phpt"
                         ;; file_get_contents(): iconv stream filter
                         ;; ("ISO-8859-1"=>"UTF-8") unknown error.
                         "ext/standard/tests/file/bug43008.phpt"
                         ;; Table data not created in sqlite(?).
                         "ext/pdo_sqlite/tests/bug_42589.phpt"
                         ;; Expects an Array with 3 preg_matches; gets 0.
                         "ext/pcre/tests/bug79846.phpt"
                         ;; Expects an empty Array; gets one with " " in it.
                         "ext/pcre/tests/bug80118.phpt"
                         ;; Renicing a process fails in the build environment.
                         "ext/standard/tests/general_functions/proc_nice_basic.phpt"
                         ;; Can fail on fast machines?
                         "Zend/tests/bug74093.phpt"))
                         ;; PCRE with/without JIT gives different result
                         "ext/pcre/tests/gh11374.phpt"
                         "ext/pcre/tests/gh11956.phpt"))

             ;; Accomodate two extra openssl errors flanking the expected one:
             ;; random number generator:RAND_{load,write}_file:Cannot open file


@@ 413,7 326,7 @@
       ("libzip" ,libzip)
       ("oniguruma" ,oniguruma)
       ("openldap" ,openldap)
       ("openssl" ,openssl-1.1)
       ("openssl" ,openssl)
       ("pcre" ,pcre2)
       ("postgresql" ,postgresql)
       ("readline" ,readline)