Hello,


We should instead use ‘01_path_max.patch’ from
<http://http.debian.net/debian/pool/main/f/fontconfig/fontconfig_2.11.0-6.3.debian.tar.xz>.


I attached the updated patch.

The code has changed in the current version, I used the version 2.12.0 of the package to update the patch.

how i know if the program will crash at run time?.


Thanks for your guide
From 21f812c2f496bdb7c39e297f66e09ea35968ddfb Mon Sep 17 00:00:00 2001
From: Rene Saavedra <ren...@openmailbox.org>
Date: Mon, 4 Jul 2016 19:34:48 -0500
Subject: [PATCH] gnu: Add fontconfig.

---
 gnu/packages/fontutils.scm                     |  8 ++-
 gnu/packages/patches/fontconfig-path-max.patch | 69 ++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 2 deletions(-)
 create mode 100644 gnu/packages/patches/fontconfig-path-max.patch

diff --git a/gnu/packages/fontutils.scm b/gnu/packages/fontutils.scm
index 5f6ff15..8ae725b 100644
--- a/gnu/packages/fontutils.scm
+++ b/gnu/packages/fontutils.scm
@@ -225,14 +225,18 @@ fonts to/from the WOFF2 format.")
 (define-public fontconfig
   (package
    (name "fontconfig")
-   (version "2.11.94")
+   (version "2.12.0")
    (source (origin
             (method url-fetch)
             (uri (string-append
                    "https://www.freedesktop.org/software/fontconfig/release/fontconfig-";
                    version ".tar.bz2"))
             (sha256 (base32
-                     "1psrl4b4gi4wmbvwwh43lk491wsl8lgvqj146prlcha3vwjc0qyp"))))
+                     "0942gl0n9zh3lwha1bfvzq7mh7pzycfys8f2mbcgss0zzzpy8cxl"))
+   ;; The patch is based on the Debian patch.
+   ;; http://http.debian.net/debian/pool/main/f/fontconfig/fontconfig_2.11.0-6.3.debian.tar.xz
+            (patches (search-patches
+                      "fontconfig-path-max.patch"))))
    (build-system gnu-build-system)
    (propagated-inputs `(("expat" ,expat)
                         ("freetype" ,freetype)))
diff --git a/gnu/packages/patches/fontconfig-path-max.patch b/gnu/packages/patches/fontconfig-path-max.patch
new file mode 100644
index 0000000..6f5a9b7
--- /dev/null
+++ b/gnu/packages/patches/fontconfig-path-max.patch
@@ -0,0 +1,69 @@
+The patch replaces the use of macro PATH_MAX, in default.c and
+fcstat.c files.
+---
+ src/fcdefault.c | 32 +++++++++++++++++++++++++-------
+ src/fcstat.c    |  3 ++-
+ 2 files changed, 27 insertions(+), 8 deletions(-)
+
+diff --git a/src/fcdefault.c b/src/fcdefault.c
+index 6647a8f..4856777 100644
+--- a/src/fcdefault.c
++++ b/src/fcdefault.c
+@@ -150,15 +150,33 @@ retry:
+ # if defined (HAVE_GETEXECNAME)
+ 	const char *p = getexecname ();
+ # elif defined (HAVE_READLINK)
+-	char buf[PATH_MAX + 1];
+-	int len;
++	int size = 128;
+ 	char *p = NULL;
+ 
+-	len = readlink ("/proc/self/exe", buf, sizeof (buf) - 1);
+-	if (len != -1)
+-	{
+-	    buf[len] = '\0';
+-	    p = buf;
++	while (1) {
++	    char *buf = malloc (size);
++	    int len;
++
++	    if (buf == NULL)
++		break;
++
++	    len = readlink ("/proc/self/exe", buf, size - 1);
++
++	    if (len < 0)
++	    {
++		free(buf);
++		break;
++	    }
++
++	    if (len < size - 1)
++	    {
++		buf[len] = '\0';
++		p = buf;
++		break;
++	    }
++
++	    free (buf);
++	    size *= 2;
+ 	}
+ # else
+ 	char *p = NULL;
+diff --git a/src/fcstat.c b/src/fcstat.c
+index 1734fa4..0f1cc00 100644
+--- a/src/fcstat.c
++++ b/src/fcstat.c
+@@ -278,7 +278,8 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
+ 	{
+ #endif
+ 	struct stat statb;
+-	char f[PATH_MAX + 1];
++	int size = 128;
++	char *f = malloc (size);
+ 
+ 	memcpy (f, dir, len);
+ 	f[len] = FC_DIR_SEPARATOR;
+-- 
+2.6.3
+
-- 
2.6.3

Reply via email to