Source: gegl
Version: 0.3.6-3
Severity: important
Tags: patch fixed-upstream
Control: forwarded -1 https://bugzilla.gnome.org/show_bug.cgi?id=764817

Hi,

gegl fails to compile on GNU/Hurd [1].

The problem is due to the usage of PATH_MAX, which has been reported
upstream [2] and fixed in Git.
Attached there is the commit with the fix, refreshed to apply cleanly
on top of gegl 0.3.6.

[1] 
https://buildd.debian.org/status/fetch.php?pkg=gegl&arch=hurd-i386&ver=0.3.6-3&stamp=1459762344
[2] https://bugzilla.gnome.org/show_bug.cgi?id=764817

Thanks,
-- 
Pino
>From 594b2fae9c96981428e8fd9e2cd6198221f814f3 Mon Sep 17 00:00:00 2001
From: Pino Toscano <[email protected]>
Date: Thu, 14 Apr 2016 23:19:03 +0200
Subject: [PATCH] Use modern realpath() everywhere

Assume everywhere that the realpath() implementation has the
POSIX.1-2008 behaviour, i.e. allowing NULL as second parameter and thus
returning a newly allocated buffer; it is not just a GNU extension.
Also, this behaviour was assumed in other parts of gegl, so there should
be no regression.

This commit also reverts commit 5d715eee845ef1ab30490259a114902d0b6533ed.
---
 gegl/gegl-xml.c               | 4 ++--
 operations/common/load.c      | 5 +++--
 operations/external/ff-load.c | 5 +++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gegl/gegl-xml.c b/gegl/gegl-xml.c
index 5260614..83069af 100644
--- a/gegl/gegl-xml.c
+++ b/gegl/gegl-xml.c
@@ -123,7 +123,6 @@ set_clone_prop_as_well:
           else
             {
               gchar * absolute_path;
-              gchar   temp_path[PATH_MAX];
               if (pd->path_root)
                 {
                   buf = g_strdup_printf ("%s/%s", pd->path_root, param_value);
@@ -133,11 +132,12 @@ set_clone_prop_as_well:
                   buf = g_strdup_printf ("./%s", param_value);
                 }
 
-              absolute_path = realpath (buf, temp_path);
+              absolute_path = realpath (buf, NULL);
               g_free (buf);
               if (absolute_path)
                 {
                   gegl_node_set (new, param_name, absolute_path, NULL);
+                  free (absolute_path);
                 }
               else
                 {
diff --git a/operations/common/load.c b/operations/common/load.c
index 67e8069..3140ebf 100644
--- a/operations/common/load.c
+++ b/operations/common/load.c
@@ -98,9 +98,9 @@ do_setup (GeglOperation *operation, const gchar *new_path, const gchar *new_uri)
     {
       const gchar *extension = strrchr (new_path, '.');
       const gchar *handler   = NULL;
-      char   resolved_path[PATH_MAX];
+      gchar *resolved_path;
 
-      realpath (new_path, resolved_path);
+      resolved_path = realpath (new_path, NULL);
 
       if (!g_file_test (resolved_path, G_FILE_TEST_EXISTS))
         {
@@ -127,6 +127,7 @@ do_setup (GeglOperation *operation, const gchar *new_path, const gchar *new_uri)
                          "path", resolved_path,
                          NULL);
         }
+      free (resolved_path);
     }
   else
     {
diff --git a/operations/external/ff-load.c b/operations/external/ff-load.c
index 40d26ce..73417c4 100644
--- a/operations/external/ff-load.c
+++ b/operations/external/ff-load.c
@@ -420,12 +420,13 @@ prepare (GeglOperation *operation)
       )
     {
       gint i;
-      gchar dereferenced_path[PATH_MAX];
+      gchar *dereferenced_path;
       gint err;
 
       ff_cleanup (o);
-      realpath (o->path, dereferenced_path);
+      dereferenced_path = realpath (o->path, NULL);
       err = avformat_open_input(&p->video_fcontext, dereferenced_path, NULL, 0);
+      free (dereferenced_path);
       if (err < 0)
         {
           print_error (o->path, err);
-- 
2.6.4

Reply via email to