[Pkg-shadow-devel] Bug#372155: shadow: FTBFS on hurd-i386: PATH_MAX issue

Michael Banck mbanck at debian.org
Thu Jun 8 14:58:12 UTC 2006

Package: shadow
Version: 1:4.0.16-1
Severity: important
Tags: patch, upstream


your package failed to autobuild on hurd-i386:

Automatic build of shadow_1:4.0.16-1 on beethoven by sbuild/hurd-i386 85
Build started at 20060608-1232
Making all in lib
make[3]: Entering directory `/build/buildd/shadow-4.0.16/lib'
/bin/sh ../libtool --mode=compile cc  -I. -I. -I..     -g
-o commonio.lo `test -f 'commonio.c' || echo './'`commonio.c
-D_FILE_OFFSET_BITS=64 -O2 -c commonio.c -o commonio.o
commonio.c: In function 'lrename':
commonio.c:50: error: 'PATH_MAX' undeclared (first use in this function)
commonio.c:50: error: (Each undeclared identifier is reported only once
commonio.c:50: error: for each function it appears in.)
make[3]: *** [commonio.lo] Error 1
make[3]: Leaving directory `/build/buildd/shadow-4.0.16/lib'
make[2]: *** [all-recursive] Error 1

The full build log can be found here:

The problem is that PATH_MAx is not defined on the GNU system (as no
such system limit exists).  There are a couple of possible fixes for
this, some being quite ugly (just pretending there was a limit by
#defining PATH_MAX anyway, for example) or somewhat involved (making
configure check for glibc specific functions like
canonicalize_file_name() and use those if availble).

The attached patch should be mostly alright (it did not get a lot of
peer review yet, though), it's only shortcoming is that it assumes any
system which does not have PATH_MAX defined is going to have a
glibc-like realpath() function.  This is definetely right for Debian and
almost definetely right for upstream (I know of no other POSIX-like
system which does not have PATH_MAX defined besides GNU/Hurd).  In any
case, it is much better than just assuming PATH_MAX to be defined


-------------- next part --------------
--- lib/commonio.c.orig	2006-06-08 15:12:21.000000000 +0200
+++ lib/commonio.c	2006-06-08 15:39:49.000000000 +0200
@@ -47,13 +47,22 @@
 int lrename (const char *old, const char *new)
+#ifdef PATH_MAX
 	char resolved_path[PATH_MAX];
+	char *resolved_path;
 	int res;
 #if defined(S_ISLNK)
 	struct stat sb = { 0 };
 	if (lstat (new, &sb) == 0 && S_ISLNK (sb.st_mode)) {
+#ifndef PATH_MAX
+		resolved_path = realpath (new, NULL);
+		if (resolved_path == NULL) {
 		if (realpath (new, resolved_path) == NULL) {
 			perror ("realpath in lrename()");
 		} else {
 			new = resolved_path;

More information about the Pkg-shadow-devel mailing list