Bug#274027: gconf2: FTFBS on hurd-i386: Unconditional use of system limits not mandated by POSIX

Michael Banck Michael Banck <mbanck@debian.org>, 274027@bugs.debian.org
Wed, 29 Sep 2004 14:33:26 +0200


--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Package: gconf2
Version: 2.6.4-2
Severity: important
Tags: patch

Hi,

gconf2 fails to build on hurd-i386 as PATH_MAX is not defined on GNU
Hurd. The GNU project/system does not impose arbitrary limits on its
users, and PATH_MAX is not mandated to be defined by POSIX. The right
fix would be to dynamically allocate enough memory to hold the paths,
but the attached patch will do for the time being. I built gconf2 with
it on GNU/Linux, and there were no issues. 

If you report this upstream, please encourage them to properly fix this,
as GNU/Linux systems might also profit from directory variables being
actually only as large as needed, and not 4096 chars as PATH_MAX says. I
don't know how common these codepaths (backends/xml-dir.c and
backends/markup-tree.c) are though.

I can quote the build log if you want, I just don't have it handy right
now.


Michael

--EeQfGwPcQSOJBaQU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="gconf_path_max.diff"

diff -Naur GConf-2.6.4.orig/backends/markup-tree.c GConf-2.6.4/backends/markup-tree.c
--- GConf-2.6.4.orig/backends/markup-tree.c	2004-09-29 14:09:44.000000000 +0200
+++ GConf-2.6.4/backends/markup-tree.c	2004-09-29 14:14:01.000000000 +0200
@@ -33,6 +33,11 @@
 #include <stdio.h>
 #include <time.h>
 
+/* PATH_MAX is not defined in limits.h on some platforms */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 typedef struct
 {
   char       *locale;
diff -Naur GConf-2.6.4.orig/backends/xml-dir.c GConf-2.6.4/backends/xml-dir.c
--- GConf-2.6.4.orig/backends/xml-dir.c	2004-09-29 14:09:44.000000000 +0200
+++ GConf-2.6.4/backends/xml-dir.c	2004-09-29 14:11:59.000000000 +0200
@@ -37,6 +37,11 @@
 #include <gconf/gconf-internals.h>
 #include "xml-entry.h"
 
+/* PATH_MAX is not defined in limits.h on some platforms */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 /* This makes hash table safer when debugging */
 #ifndef GCONF_ENABLE_DEBUG
 #define safe_g_hash_table_insert g_hash_table_insert

--EeQfGwPcQSOJBaQU--