Bug#472129: glib2.0: FTBFS on hurd-i386 because of unconditionnal use of ARG_MAX

Samuel Thibault samuel.thibault at ens-lyon.org
Sat Mar 22 11:09:12 UTC 2008


Package: glib2.0
Version: 2.16.1
Severity: important
Tags: upstream patch
Reported-Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=522335

Hello,

glib2.0 FBTFS on hurd-i386 (hence blocking a huge amount of packages)
because of unconditionnal use of ARG_MAX (it is acually even bogus since
ARG_MAX is in bytes, not number of arguments). hurd-i386 doesn't have
any limit on the length of the command line, here is a patch to
dynamically allocate it.

Samuel

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24.1
Locale: LANG=fr_FR at euro, LC_CTYPE=fr_FR at euro (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash
-------------- next part --------------
--- glib2.0-2.16.1/glib/gtester.c	2008-03-11 00:31:57.000000000 +0000
+++ glib2.0-2.16.1-mine/glib/gtester.c	2008-03-22 11:03:40.000000000 +0000
@@ -273,7 +273,8 @@ launch_test_binary (const char *binary,
   GTestLogBuffer *tlb;
   GSList *slist, *free_list = NULL;
   GError *error = NULL;
-  const gchar *argv[ARG_MAX];
+  int argc = 0;
+  const gchar **argv;
   GPid pid = 0;
   gint report_pipe[2] = { -1, -1 };
   guint child_report_cb_id = 0;
@@ -289,7 +290,34 @@ launch_test_binary (const char *binary,
       return FALSE;
     }
 
+  /* setup argc */
+  for (slist = subtest_args; slist; slist = slist->next)
+    argc++;
+  /* argc++; */
+  if (subtest_quiet)
+    argc++;
+  if (subtest_verbose)
+    argc++;
+  if (!subtest_mode_fatal)
+    argc++;
+  if (subtest_mode_quick)
+    argc++;
+  else
+    argc++;
+  if (subtest_mode_perf)
+    argc++;
+  if (gtester_list_tests)
+    argc++;
+  if (subtest_seedstr)
+    argc++;
+  argc++;
+  if (skip_tests)
+    argc++;
+  for (slist = subtest_paths; slist; slist = slist->next)
+    argc++;
+
   /* setup argv */
+  argv = gmalloc ((argc + 1) * sizeof(gchar *));
   argv[i++] = binary;
   for (slist = subtest_args; slist; slist = slist->next)
     argv[i++] = (gchar*) slist->data;
@@ -343,8 +371,10 @@ launch_test_binary (const char *binary,
       else
         g_warning ("Failed to execute test binary: %s: %s", argv[0], error->message);
       g_clear_error (&error);
+      gfree (argv);
       return FALSE;
     }
+  gfree (argv);
 
   subtest_running = TRUE;
   subtest_io_pending = TRUE;


More information about the pkg-gnome-maintainers mailing list