Hi,

GNU/Hurd doesn't have PATH_MAX or MAXHOSTNAMELEN (arbitrarily long strings can
be used). Since attempting to replace every instance of static allocation with
dynamic buffer management would make for a very intrusive patch, I'm proposing
to just define the limits as alternative.

I took care to use the same limits Rump namespace has, just to avoid accidental
cross-definition of a different value causing damage somewhere (e.g. overflows
or such).

-- 
Robert Millan
--- a/buildrump.sh/buildrump.sh
+++ b/buildrump.sh/buildrump.sh
@@ -1074,6 +1074,7 @@
 	*-gnu*)
 		EXTRA_RUMPCOMMON='-ldl'
 		EXTRA_RUMPCLIENT='-lpthread'
+		appendvar EXTRA_CFLAGS -DMAXHOSTNAMELEN=256 -DPATH_MAX=1024
 		;;
 	*-openbsd*)
 		EXTRA_RUMPCLIENT='-lpthread'
--- a/buildrump.sh/src/tools/compat/Makefile
+++ b/buildrump.sh/src/tools/compat/Makefile
@@ -38,6 +38,11 @@
 CPPFLAGS+=	-I. -I./include -I${.CURDIR} -I${.CURDIR}/sys \
 		-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
 
+# Define MAXPATHLEN limit on GNU/Hurd
+.if ${BUILD_OSTYPE} == "GNU"
+CPPFLAGS+=	-DMAXPATHLEN=1024 -DPATH_MAX=1024
+.endif
+
 .PATH:		${.CURDIR}/../../lib/libc/cdb \
 		${.CURDIR}/../../lib/libc/gen \
 		${.CURDIR}/../../lib/libc/hash \
--- a/buildrump.sh/src/tools/compat/defs.mk.in
+++ b/buildrump.sh/src/tools/compat/defs.mk.in
@@ -79,6 +79,11 @@
 HOST_CPPFLAGS+=	${COMPATINCFLAGS} -I${NETBSDSRCDIR}/tools/compat \
 		-DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64
 
+# Define MAXPATHLEN limit on GNU/Hurd
+.if ${BUILD_OSTYPE} == "GNU"
+HOST_CPPFLAGS+= -DMAXPATHLEN=1024 -DPATH_MAX=1024
+.endif
+
 .if "${COMPATLIB_NO_LIB}" != "yes"
 DPADD+=		${COMPATLIBDIR}/libnbcompat.a
 LDADD+=		-L${COMPATLIBDIR} -lnbcompat @LIBS@
--- a/buildrump.sh/src/tools/make/configure
+++ b/buildrump.sh/src/tools/make/configure
@@ -971,6 +971,10 @@
 #define DEFSHELL_CUSTOM "${BSHELL}"
 EOF
 
+cat >>confdefs.h <<EOF
+#define MAXPATHLEN 1024
+EOF
+
 # Make sure we have POSIX regex ability.
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
--- a/buildrump.sh/src/tools/make/configure.ac
+++ b/buildrump.sh/src/tools/make/configure.ac
@@ -24,6 +24,7 @@
 
 AC_INIT([make], [noversion], [bin-bug-peo...@netbsd.org])
 AC_CONFIG_FILES(buildmake.sh)
+AC_CANONICAL_HOST()
 
 AC_PATH_PROG(BSHELL, sh)
 if test x"$BSHELL" = x; then
@@ -31,6 +32,13 @@
 fi
 AC_DEFINE_UNQUOTED(DEFSHELL_CUSTOM, "${BSHELL}")
 
+case $host_os in
+	gnu*)
+		# Define MAXPATHLEN limit on GNU/Hurd
+		AC_DEFINE_UNQUOTED(MAXPATHLEN, 1024)
+	;;
+esac
+
 # Make sure we have POSIX regex ability.
 AC_CHECK_HEADER(regex.h,, AC_MSG_ERROR([POSIX regex.h is required]))
 

Reply via email to