unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* update php
@ 2017-02-17 16:27 julien lepiller
  2017-02-17 21:50 ` Leo Famulari
  0 siblings, 1 reply; 2+ messages in thread
From: julien lepiller @ 2017-02-17 16:27 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 2434 bytes --]

Hi,

A new version of php has been released. I'm a bit confused by the way 
grafting works and as the gd update from last time is still not in 
master, gd-for-php will try to build using gd-2.2.3, which I don't want 
(2.2.4 fixes issues that would otherwise be detected by the php tests). 
I have no idea how to make it work correctly and will not be able to 
work on it this week-end, so feel free to do whatever is necessary to 
get this update. I have attached a patch that removes the graft so that 
gd is now 2.2.4 by default.

Four more tests fail currently. Two of them are new tests on the same 
issues as already failing tests, and two of them seem to segfault 
because of a bug in the way Zend terminates. I could get this stack 
trace:

#0  zend_hash_destroy (ht=0xfe6538 <phpdbg_globals+1400>) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend_hash.c:1249
#1  0x0000000000776921 in zm_shutdown_phpdbg (type=<optimized out>, 
module_number=<optimized out>) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/sapi/phpdbg/phpdbg.c:234
#2  0x00000000006d9333 in module_destructor 
(module=module@entry=0x10a44e0) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend_API.c:2499
#3  0x00000000006d23cc in module_destructor_zval (zv=<optimized out>) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend.c:632
#4  0x00000000006e4229 in _zend_hash_del_el_ex (prev=<optimized out>, 
p=<optimized out>, idx=<optimized out>, ht=<optimized out>)
     at /tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend_hash.c:998
#5  _zend_hash_del_el (p=0x10738c0, idx=47, ht=0xfe30a0 
<module_registry>) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend_hash.c:1021
#6  zend_hash_graceful_reverse_destroy (ht=ht@entry=0xfe30a0 
<module_registry>) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend_hash.c:1477
#7  0x00000000006d781c in zend_destroy_modules () at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend_API.c:1978
#8  0x00000000006d2eb5 in zend_shutdown () at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/Zend/zend.c:871
#9  0x0000000000673acb in php_module_shutdown () at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/main/main.c:2405
#10 0x0000000000444846 in main (argc=68, argv=0x7fffffffd3c8) at 
/tmp/guix-build-php-7.1.2.drv-0/php-7.1.2/sapi/phpdbg/phpdbg.c:2156

I didn't test the new php, but it seems to work in most cases so I think 
we can still update it. Another solution would be to try and build 
7.0.16.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-php-Update-to-7.1.2.patch --]
[-- Type: text/x-diff; name=0001-gnu-php-Update-to-7.1.2.patch, Size: 10734 bytes --]

From 79db2573fcf2840cd463e675063625771e411211 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Thu, 16 Feb 2017 17:47:51 +0100
Subject: [PATCH] gnu: php: Update to 7.1.2.

* gnu/packages/php.scm (php): Update to 7.1.2.
---
 gnu/local.mk                                       |   1 +
 gnu/packages/gd.scm                                |  46 +++------
 .../patches/gd-php-73968-Fix-109-XBM-reading.patch | 111 +++++++++++++++++++++
 gnu/packages/php.scm                               |  20 ++--
 4 files changed, 140 insertions(+), 38 deletions(-)
 create mode 100644 gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 060de25..7e6dd31 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -576,6 +576,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gd-fix-gd2-read-test.patch		\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-fix-truecolor-format-correction.patch	\
+  %D%/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch			\
   %D%/packages/patches/gegl-CVE-2012-4433.patch			\
   %D%/packages/patches/geoclue-config.patch			\
   %D%/packages/patches/ghc-dont-pass-linker-flags-via-response-files.patch	\
diff --git a/gnu/packages/gd.scm b/gnu/packages/gd.scm
index 713f7ae..b8f9495 100644
--- a/gnu/packages/gd.scm
+++ b/gnu/packages/gd.scm
@@ -36,12 +36,11 @@
 (define-public gd
   (package
     (name "gd")
-    (replacement gd-2.2.4)
 
     ;; Note: With libgd.org now pointing to github.com, genuine old
     ;; tarballs are no longer available.  Notably, versions 2.0.x are
     ;; missing.
-    (version "2.2.3")
+    (version "2.2.4")
 
     (source (origin
              (method url-fetch)
@@ -50,10 +49,8 @@
                    version "/libgd-" version ".tar.xz"))
              (sha256
               (base32
-               "0g3xz8jpz1pl2zzmssglrpa9nxiaa7rmcmvgpbrjz8k9cyynqsvl"))
-             (patches (search-patches "gd-CVE-2016-7568.patch"
-                                      "gd-CVE-2016-8670.patch"
-                                      "gd-fix-gd2-read-test.patch"
+               "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))
+             (patches (search-patches "gd-fix-gd2-read-test.patch"
                                       "gd-fix-tests-on-i686.patch"))))
     (build-system gnu-build-system)
     (native-inputs
@@ -65,6 +62,17 @@
     (propagated-inputs
      `(("fontconfig" ,fontconfig)
        ("libjpeg" ,libjpeg)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; This test is known to fail on i686-linux:
+         ;; https://github.com/libgd/libgd/issues/359
+         ;; TODO Replace this substitution with an upstream bug fix.
+         (add-after 'unpack 'disable-failing-test
+           (lambda _
+             (substitute* "tests/gdimagegrayscale/basic.c"
+               (("return gdNumFailures\\(\\)")
+                 "return 0")))))))
     (home-page "http://www.libgd.org/")
     (synopsis "Library for the dynamic creation of images by programmers")
     (description
@@ -78,32 +86,6 @@ most common applications of GD involve website development.")
                            "See COPYING file in the distribution."))
     (properties '((cpe-name . "libgd")))))
 
-(define gd-2.2.4
-  (package
-    (inherit gd)
-    (version "2.2.4")
-    (source
-      (origin
-        (method url-fetch)
-        (uri (string-append "https://github.com/libgd/libgd/releases/download/"
-                            "gd-" version "/libgd-" version ".tar.xz"))
-        (patches (search-patches "gd-fix-gd2-read-test.patch"
-                                 "gd-fix-tests-on-i686.patch"))
-        (sha256
-         (base32
-          "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))))
-    (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         ;; This test is known to fail on i686-linux:
-         ;; https://github.com/libgd/libgd/issues/359
-         ;; TODO Replace this substitution with an upstream bug fix.
-         (add-after 'unpack 'disable-failing-test
-           (lambda _
-             (substitute* "tests/gdimagegrayscale/basic.c"
-               (("return gdNumFailures\\(\\)")
-                 "return 0")))))))))
-
 (define-public perl-gd
   (package
     (name "perl-gd")
diff --git a/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch b/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch
new file mode 100644
index 0000000..ce69a73
--- /dev/null
+++ b/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch
@@ -0,0 +1,111 @@
+From 082c5444838ea0d84f9fb6441aefdb44d78d9bba Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Fri, 20 Jan 2017 22:48:20 +0100
+Subject: [PATCH] Fix #109: XBM reading fails with printed error
+
+When calculating the number of required bytes of an XBM image, we have
+to take the line padding into account.
+---
+ src/gd_xbm.c                     |   2 +-
+ tests/xbm/CMakeLists.txt         |   1 +
+ tests/xbm/Makemodule.am          |   5 ++++-
+ tests/xbm/github_bug_109.c       |  35 +++++++++++++++++++++++++++++++++++
+ tests/xbm/github_bug_109.xbm     |   5 +++++
+ 5 files changed, 47 insertions(+), 2 deletions(-)
+ create mode 100644 tests/xbm/github_bug_109.c
+ create mode 100644 tests/xbm/github_bug_109.xbm
+ create mode 100644 tests/xbm/github_bug_109_exp.png
+
+diff --git a/src/gd_xbm.c b/src/gd_xbm.c
+index 5f09b56..c2ba2ad 100644
+--- a/src/gd_xbm.c
++++ b/src/gd_xbm.c
+@@ -108,7 +108,7 @@ BGD_DECLARE(gdImagePtr) gdImageCreateFromXbm(FILE * fd)
+ 				max_bit = 32768;
+ 			}
+ 			if (max_bit) {
+-				bytes = (width * height / 8) + 1;
++                bytes = (width + 7) / 8 * height;
+ 				if (!bytes) {
+ 					return 0;
+ 				}
+diff --git a/tests/xbm/CMakeLists.txt b/tests/xbm/CMakeLists.txt
+index 183cf5e..08576e0 100644
+--- a/tests/xbm/CMakeLists.txt
++++ b/tests/xbm/CMakeLists.txt
+@@ -1,4 +1,5 @@
+ LIST(APPEND TESTS_FILES
++	github_bug_109
+ 	github_bug_170
+ )
+ 
+diff --git a/tests/xbm/Makemodule.am b/tests/xbm/Makemodule.am
+index ba1eabd..0f5beb6 100644
+--- a/tests/xbm/Makemodule.am
++++ b/tests/xbm/Makemodule.am
+@@ -1,5 +1,8 @@
+ libgd_test_programs += \
++	xbm/github_bug_109 \
+ 	xbm/github_bug_170
+ 
+ EXTRA_DIST += \
+-	xbm/CMakeLists.txt
++	xbm/CMakeLists.txt \
++	xbm/github_bug_109.xbm \
++	xbm/github_bug_109_exp.png
+diff --git a/tests/xbm/github_bug_109.c b/tests/xbm/github_bug_109.c
+new file mode 100644
+index 0000000..1a020c6
+--- /dev/null
++++ b/tests/xbm/github_bug_109.c
+@@ -0,0 +1,35 @@
++/**
++ * Test reading of XBM images with a width that is not a multiple of 8
++ *
++ * We're reading such an XBM image, and check that we got what we've expected,
++ * instead of an error message.
++ *
++ * See also <https://github.com/libgd/libgd/issues/109>.
++ */
++
++
++#include "gd.h"
++#include "gdtest.h"
++
++
++int main()
++{
++    gdImagePtr im;
++    FILE *fp;
++    char *path;
++
++    fp = gdTestFileOpen2("xbm", "github_bug_109.xbm");
++    im = gdImageCreateFromXbm(fp);
++    fclose(fp);
++    gdTestAssert(im != NULL);
++    gdTestAssert(gdImageGetTrueColorPixel(im, 0, 0) == 0);
++    gdTestAssert(gdImageGetTrueColorPixel(im, 0, 1) == 0xffffff);
++
++    path = gdTestFilePath2("xbm", "github_bug_109_exp.png");
++    gdAssertImageEqualsToFile(path, im);
++    gdFree(path);
++
++    gdImageDestroy(im);
++
++    return gdNumFailures();
++}
+diff --git a/tests/xbm/github_bug_109.xbm b/tests/xbm/github_bug_109.xbm
+new file mode 100644
+index 0000000..f427d86
+--- /dev/null
++++ b/tests/xbm/github_bug_109.xbm
+@@ -0,0 +1,5 @@
++#define test_width 10
++#define test_height 10
++static unsigned char test_bits[] = {
++  0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00, 
++  0xFF, 0x03, 0x00, 0x00, 0xFF, 0x03, 0x00, 0x00};
+
+-- 
+2.7.4
+
diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index a84ff43..33d9276 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -51,20 +51,20 @@
   #:use-module ((guix licenses) #:prefix license:))
 
 ;; This fixes PHP bugs 73155 and 73159. Remove when gd
-;; is updated to > 2.2.3.
-(define gd-for-php
+;; is updated to > 2.2.4.
+(define-public gd-for-php
   (package (inherit gd)
+           (name "gd-for-php")
            (source
             (origin
               (inherit (package-source gd))
               (patches (search-patches
-                        "gd-fix-truecolor-format-correction.patch"
-                        "gd-fix-chunk-size-on-boundaries.patch"))))))
+                        "gd-php-73968-Fix-109-XBM-reading.patch"))))))
 
 (define-public php
   (package
     (name "php")
-    (version "7.0.14")
+    (version "7.1.2")
     (home-page "https://secure.php.net/")
     (source (origin
               (method url-fetch)
@@ -72,7 +72,7 @@
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "12ccgbrfchgvmcfb88rcknq7xmrf19c5ysdr4v8jxk51j9izy78g"))
+                "0wg9ng230w724rpwsrhcg4pw41xm1xhz0zx76haanyymkz1s05fq"))
               (modules '((guix build utils)))
               (snippet
                '(with-directory-excursion "ext"
@@ -205,6 +205,12 @@
                          "ext/standard/tests/strings/setlocale_basic3.phpt"
                          "ext/standard/tests/strings/setlocale_variation1.phpt"
 
+                         ;; XXX: These tests fail.  The output is correct, but
+                         ;; the tests segfault at the end. This seems to be
+                         ;; related to Zend closing.
+                         "sapi/phpdbg/tests/include_once.phpt"
+                         "sapi/phpdbg/tests/phpdbg_get_executable_stream_wrapper.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
@@ -258,8 +264,10 @@
                          "ext/gd/tests/bug43073.phpt"
                          ;; imagettftext() returns wrong coordinates.
                          "ext/gd/tests/bug48732.phpt"
+                         "ext/gd/tests/bug48732-mb.phpt"
                          ;; Similarly for imageftbbox().
                          "ext/gd/tests/bug48801.phpt"
+                         "ext/gd/tests/bug48801-mb.phpt"
                          ;; Different expected output from imagecolorallocate().
                          "ext/gd/tests/bug53504.phpt"
                          ;; Wrong image size after scaling an image.
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: update php
  2017-02-17 16:27 update php julien lepiller
@ 2017-02-17 21:50 ` Leo Famulari
  0 siblings, 0 replies; 2+ messages in thread
From: Leo Famulari @ 2017-02-17 21:50 UTC (permalink / raw)
  To: julien lepiller; +Cc: guix-devel

On Fri, Feb 17, 2017 at 05:27:58PM +0100, julien lepiller wrote:
> Hi,
> 
> A new version of php has been released. I'm a bit confused by the way
> grafting works and as the gd update from last time is still not in master,
> gd-for-php will try to build using gd-2.2.3, which I don't want (2.2.4 fixes
> issues that would otherwise be detected by the php tests). I have no idea
> how to make it work correctly and will not be able to work on it this
> week-end, so feel free to do whatever is necessary to get this update. I
> have attached a patch that removes the graft so that gd is now 2.2.4 by
> default.

Whenever I am confused about how a graft is working in practice, I check
the references of the package I am wondering about:

$ ./pre-inst-env guix build -e '(@@ (gnu packages php) gd-for-php)'              
/gnu/store/f46x9yplpq0dymm3kp4hrl3rv1ijlajx-gd-2.2.4                      
$ ./pre-inst-env guix build -e '(@@ (gnu packages php) gd-for-php)' --no-grafts
/gnu/store/ir4ldfw5paaf7xg34xckysl8xy9sjpmg-gd-2.2.3
$ guix gc --references $(./pre-inst-env guix build php --fallback --no-grafts) | grep -- -gd-
/gnu/store/ir4ldfw5paaf7xg34xckysl8xy9sjpmg-gd-2.2.3
$ guix gc --references $(./pre-inst-env guix build php --fallback) | grep -- -gd- 
/gnu/store/f46x9yplpq0dymm3kp4hrl3rv1ijlajx-gd-2.2.4

gd-for-php is using gd-2.2.4, and php is using the correct gd-for-php.
If the new patch fails to apply to gd@2.2.3, we can apply it to
gd-2.2.4, right?

> From: Julien Lepiller <julien@lepiller.eu>
> Date: Thu, 16 Feb 2017 17:47:51 +0100
> Subject: [PATCH] gnu: php: Update to 7.1.2.
> 
> * gnu/packages/php.scm (php): Update to 7.1.2.

The commit message needs to describe the changes noted below ↓

> ---
>  gnu/local.mk                                       |   1 +
>  gnu/packages/gd.scm                                |  46 +++------
>  .../patches/gd-php-73968-Fix-109-XBM-reading.patch | 111 +++++++++++++++++++++
>  gnu/packages/php.scm                               |  20 ++--
>  4 files changed, 140 insertions(+), 38 deletions(-)
>  create mode 100644 gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch

>  (define-public gd
>    (package
>      (name "gd")
> -    (replacement gd-2.2.4)
>  
>      ;; Note: With libgd.org now pointing to github.com, genuine old
>      ;; tarballs are no longer available.  Notably, versions 2.0.x are
>      ;; missing.
> -    (version "2.2.3")
> +    (version "2.2.4")

`guix refresh --list-dependent gd` shows that this update will require
735 package rebuilds, which is more than we do on the master branch.
This update is ready to be built with the other major changes on the
core-updates branch.

> diff --git a/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch b/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch
> new file mode 100644
> index 0000000..ce69a73
> --- /dev/null
> +++ b/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch
> @@ -0,0 +1,111 @@
> +From 082c5444838ea0d84f9fb6441aefdb44d78d9bba Mon Sep 17 00:00:00 2001
> +From: "Christoph M. Becker" <cmbecker69@gmx.de>
> +Date: Fri, 20 Jan 2017 22:48:20 +0100
> +Subject: [PATCH] Fix #109: XBM reading fails with printed error
> +
> +When calculating the number of required bytes of an XBM image, we have
> +to take the line padding into account.

Can you add a link to the source of these patches? We should make it
easy for those reading the code to reproduce the patch from its source.

> +                         ;; XXX: These tests fail.  The output is correct, but
> +                         ;; the tests segfault at the end. This seems to be
> +                         ;; related to Zend closing.
> +                         "sapi/phpdbg/tests/include_once.phpt"
> +                         "sapi/phpdbg/tests/phpdbg_get_executable_stream_wrapper.phpt"

Let's report this upstream.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-17 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17 16:27 update php julien lepiller
2017-02-17 21:50 ` Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).