bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hurd builds


From: Paul Eggert
Subject: Re: hurd builds
Date: Wed, 03 Aug 2011 15:22:04 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Thunderbird/3.1.11

On 08/03/11 13:07, Simon Josefsson wrote:
> It seems weird for test-getcwd.c to include pathmax.h and then do a
> #ifndef PATH_MAX test?

It is weird, and wrong.  And looking at the code, there are other
glitches with respect to PATH_MAX.  Does the following quick patch
work for you on the Hurd?  The basic idea is to add a new symbol
GNULIB_defined_PATH_MAX for when gnulib defines PATH_MAX, and
to remove some code that isn't needed now that pathmax.h is included.

diff --git a/lib/canonicalize-lgpl.c b/lib/canonicalize-lgpl.c
index 1574ec1..abc9309 100644
--- a/lib/canonicalize-lgpl.c
+++ b/lib/canonicalize-lgpl.c
@@ -120,13 +120,7 @@ __realpath (const char *name, char *resolved)
       return NULL;
     }
 
-#ifdef PATH_MAX
   path_max = PATH_MAX;
-#else
-  path_max = pathconf (name, _PC_PATH_MAX);
-  if (path_max <= 0)
-    path_max = 1024;
-#endif
 
   if (resolved == NULL)
     {
diff --git a/lib/chdir-long.h b/lib/chdir-long.h
index 1ad9dd8..59d3562 100644
--- a/lib/chdir-long.h
+++ b/lib/chdir-long.h
@@ -19,15 +19,9 @@
 #include <unistd.h>
 #include <limits.h>
 
-#ifndef PATH_MAX
-# ifdef MAXPATHLEN
-#  define PATH_MAX MAXPATHLEN
-# endif
-#endif
-
 /* On systems without PATH_MAX, presume that chdir accepts
    arbitrarily long directory names.  */
-#ifndef PATH_MAX
+#if ! defined PATH_MAX || defined GNULIB_defined_PATH_MAX
 # define chdir_long(Dir) chdir (Dir)
 #else
 int chdir_long (char *dir);
diff --git a/lib/clean-temp.c b/lib/clean-temp.c
index 0ac9fa0..1a16e3d 100644
--- a/lib/clean-temp.c
+++ b/lib/clean-temp.c
@@ -59,15 +59,6 @@
 
 #define _(str) gettext (str)
 
-/* GNU Hurd doesn't have PATH_MAX.  */
-#ifndef PATH_MAX
-# ifdef MAXPATHLEN
-#  define PATH_MAX MAXPATHLEN
-# else
-#  define PATH_MAX 1024
-# endif
-#endif
-
 #ifndef uintptr_t
 # define uintptr_t unsigned long
 #endif
diff --git a/lib/pathmax.h b/lib/pathmax.h
index c6793f6..ea4605a 100644
--- a/lib/pathmax.h
+++ b/lib/pathmax.h
@@ -36,6 +36,7 @@
 # if !defined PATH_MAX && defined _PC_PATH_MAX && defined HAVE_PATHCONF
 #  define PATH_MAX (pathconf ("/", _PC_PATH_MAX) < 1 ? 1024 \
                     : pathconf ("/", _PC_PATH_MAX))
+#  define GNULIB_defined_PATH_MAX 1
 # endif
 
 /* Don't include sys/param.h if it already has been.  */
diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c
index 3381077..3962baf 100644
--- a/tests/test-getcwd.c
+++ b/tests/test-getcwd.c
@@ -108,7 +108,7 @@ test_abort_bug (void)
 static int
 test_long_name (void)
 {
-#ifndef PATH_MAX
+#if ! defined PATH_MAX || defined GNULIB_defined_PATH_MAX
   /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
      at least not on a local file system.  And if we were to start worrying
      about remote file systems, we'd have to enable the wrapper function



reply via email to

[Prev in Thread] Current Thread [Next in Thread]