all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: julien lepiller <julien@lepiller.eu>
To: guix-devel@gnu.org
Subject: Re: PHP on core-updates
Date: Mon, 27 Feb 2017 11:24:42 +0100	[thread overview]
Message-ID: <7ab1df6095300e461f6a51bc86246194@lepiller.eu> (raw)
In-Reply-To: <20170226204633.GA1501@jasmine>

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

Le 2017-02-26 21:46, Leo Famulari a écrit :
> Hi Julien,
> 
> Libgd is updated to 2.2.4 on the core-updates branch.
> 
> Can you take a look and decide what to do with gd-for-php on that
> branch?

I think php-for-gd would break with the new version (it would fail to 
apply the patches), so I'd like to get rid of it, and use our gd package 
instead.

I found an issue with gd that was discovered by php, reported to gd and 
fixed in their repo. I've extracted a patch from the gd repo and would 
like to add it to our package. I found a way to "fix" the newly failing 
tests and reported them upstream. I've attached two patches I'd like to 
see in core-updates. I haven't tested them yet, though, but comments 
would be highly appreciated ;)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-gd-Fix-an-issue-with-XBM-decoding.patch --]
[-- Type: text/x-diff; name=0001-gnu-gd-Fix-an-issue-with-XBM-decoding.patch, Size: 5678 bytes --]

From 6ee0afac1c72c8e92dcd0384090ead62d5e0cf8a Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 27 Feb 2017 11:09:11 +0100
Subject: [PATCH 1/2] gnu: gd: Fix an issue with XBM decoding.

* gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch: New file.
* gnu/local.scm (dist_patch_DATA): Add it.
* gnu/packages/gd.scm (gd)[source]: Use it.
---
 gnu/local.mk                                       |   1 +
 gnu/packages/gd.scm                                |   3 +-
 .../patches/gd-php-73968-Fix-109-XBM-reading.patch | 114 +++++++++++++++++++++
 3 files changed, 117 insertions(+), 1 deletion(-)
 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 3d9ad70..271d2c4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -582,6 +582,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/gd-fix-tests-on-i686.patch		\
   %D%/packages/patches/gd-fix-truecolor-format-correction.patch	\
   %D%/packages/patches/gd-freetype-test-failure.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 8cac242..664e653 100644
--- a/gnu/packages/gd.scm
+++ b/gnu/packages/gd.scm
@@ -52,7 +52,8 @@
                "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))
              (patches (search-patches "gd-fix-gd2-read-test.patch"
                                       "gd-fix-tests-on-i686.patch"
-                                      "gd-freetype-test-failure.patch"))))
+                                      "gd-freetype-test-failure.patch"
+                                      "gd-php-73968-Fix-109-XBM-reading.patch"))))
     (build-system gnu-build-system)
     (arguments
      `(#:phases
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..bfaa4ff
--- /dev/null
+++ b/gnu/packages/patches/gd-php-73968-Fix-109-XBM-reading.patch
@@ -0,0 +1,114 @@
+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.
+
+This patch has been taken from the gd repository and binary files have been
+removed from the patch because our patch procedure doesn't support that format.
+---
+ 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
+
-- 
2.7.4


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

From b9b181a0a82e7931a98db6916f34ea9223aa2034 Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
Date: Mon, 27 Feb 2017 11:15:29 +0100
Subject: [PATCH 2/2] gnu: php: Update to 7.1.2.

* gnu/packages/php.scm (php): Update to 7.1.2.
---
 gnu/packages/php.scm | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index 16b0985..7a09b96 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -50,21 +50,10 @@
   #:use-module (guix build-system gnu)
   #: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
-  (package (inherit gd)
-           (source
-            (origin
-              (inherit (package-source gd))
-              (patches (search-patches
-                        "gd-fix-truecolor-format-correction.patch"
-                        "gd-fix-chunk-size-on-boundaries.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 +61,7 @@
                                   name "-" version ".tar.xz"))
               (sha256
                (base32
-                "12ccgbrfchgvmcfb88rcknq7xmrf19c5ysdr4v8jxk51j9izy78g"))
+                "0wg9ng230w724rpwsrhcg4pw41xm1xhz0zx76haanyymkz1s05fq"))
               (modules '((guix build utils)))
               (snippet
                '(with-directory-excursion "ext"
@@ -179,6 +168,13 @@
                             "ext/standard/tests/general_functions/bug44667.phpt"
                             "ext/standard/tests/general_functions/proc_open.phpt")
                (("/bin/cat") (which "cat")))
+
+             ;; These tests fail because they include a file whose modification
+             ;; time is 0. Touch them to make the test pass. The issue is reported
+             ;; upstream as #74137.
+             (utime "sapi/phpdbg/tests/include_once.phpt" 1 1)
+             (utime "sapi/phpdbg/tests/phpdbg_get_executable_stream_wrapper.phpt" 1 1)
+
              ;; The encoding of this file is not recognized, so we simply drop it.
              (delete-file "ext/mbstring/tests/mb_send_mail07.phpt")
 
@@ -257,8 +253,10 @@
                          ;; The test expects an Array, but instead get the contents(?).
                          "ext/gd/tests/bug43073.phpt"
                          ;; imagettftext() returns wrong coordinates.
+                         "ext/gd/tests/bug48732-mb.phpt"
                          "ext/gd/tests/bug48732.phpt"
                          ;; Similarly for imageftbbox().
+                         "ext/gd/tests/bug48801-mb.phpt"
                          "ext/gd/tests/bug48801.phpt"
                          ;; Different expected output from imagecolorallocate().
                          "ext/gd/tests/bug53504.phpt"
@@ -291,7 +289,7 @@
        ("curl" ,curl)
        ("cyrus-sasl" ,cyrus-sasl)
        ("freetype" ,freetype)
-       ("gd" ,gd-for-php)
+       ("gd" ,gd)
        ("gdbm" ,gdbm)
        ("glibc" ,glibc)
        ("gmp" ,gmp)
-- 
2.7.4


  reply	other threads:[~2017-02-27 10:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-26 20:46 PHP on core-updates Leo Famulari
2017-02-27 10:24 ` julien lepiller [this message]
     [not found]   ` <20170227210958.GB3643@jasmine>
2017-02-28  8:03     ` Julien Lepiller
  -- strict thread matches above, loose matches on Subject: below --
2017-03-01 15:34 julien lepiller
2017-03-01 16:25 ` Marius Bakke
2017-03-01 17:09   ` Leo Famulari
2017-03-01 17:22 ` Leo Famulari
2017-03-02 16:37 ` julien lepiller
2017-03-02 16:55   ` Marius Bakke
2017-03-02 17:18     ` Leo Famulari
2017-03-03  9:28       ` julien lepiller
2017-03-03 19:31         ` Leo Famulari
2017-03-02 17:17   ` Leo Famulari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7ab1df6095300e461f6a51bc86246194@lepiller.eu \
    --to=julien@lepiller.eu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.