Source: bmake
Version: 20140620-1
Severity: important
User: [email protected]
Usertags: hurd
Tags: patch

Hi,

bmake fails to build from source on GNU/Hurd due to MAXPATHLEN
usage, which is not defined. Additionally bmake is flagged as
out-of-date for Hurd.

The patch 130_maxpathlen.diff defines MAXPATHLEN to 4096 in make.h if
not defined. Two lines above is a check setting MAXPATHLEN to
BMAKE_PATH_MAX if it is defined. Unfortunately it is not by running
autoreconf in configure.in as it is currently written. The simplest way
to solve this problem is to combine the two checks for MAXPATHLEN in
130_maxpathlen.diff. Attached is an updated patch.

Thanks!
From: Thorsten Glaser <[email protected]>

Port to hurd-i386 (Closes: #547459)
- make.h: define MAXPATHLEN if not defined (XXX kludge)
- main.c: check sysconf(_PC_PATH_MAX) and bail out if larger than
  the defined kludge value; inform the user appropriately.

Index: bmake-20140620/main.c
===================================================================
--- bmake-20140620.orig/main.c
+++ bmake-20140620/main.c
@@ -621,6 +621,17 @@ rearg:
 
 	oldVars = TRUE;
 
+#ifdef MAXPATHLEN_UNDEFINED
+	if (sysconf(_PC_PATH_MAX) > MAXPATHLEN) {
+		fprintf(stderr, "This operating system runs with "
+		    "sysconf(_PC_PATH_MAX) > MAXPATHLEN\n(%ld > %ld). "
+		    "Please change the guesstimated value at the bottom\n"
+		    "of 'make.h' and recompile, or reduce the actual "
+		    "value.\n", sysconf(_PC_PATH_MAX), (long)MAXPATHLEN);
+		return (255);
+	}
+#endif
+
 	/*
 	 * See if the rest of the arguments are variable assignments and
 	 * perform them if so. Else take them to be targets and stuff them
Index: bmake-20140620/make.h
===================================================================
--- bmake-20140620.orig/make.h
+++ bmake-20140620/make.h
@@ -518,8 +518,14 @@ int str2Lst_Append(Lst, char *, const ch
 #define MAX(a, b) ((a > b) ? a : b)
 #endif
 
+/* maybe Debian GNU/HURD */
 #ifndef MAXPATHLEN
+#ifdef BMAKE_PATH_MAX
 #define MAXPATHLEN BMAKE_PATH_MAX
+#else
+#define MAXPATHLEN	4096	/* some sensible value */
+#define MAXPATHLEN_UNDEFINED	/* triggers check in main.c */
+#endif
 #endif
 
 #endif /* _MAKE_H_ */

Reply via email to