bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] canonicalize-lgpl: work around AIX realpath bug


From: Eric Blake
Subject: [PATCH] canonicalize-lgpl: work around AIX realpath bug
Date: Mon, 6 Jun 2011 16:32:16 -0600

AIX 7.1 realpath() gets horribly confused by consecutive /
in the name to be resolved.

* m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Expose AIX bug.
* doc/posix-functions/realpath.texi (realpath): Document it.
Reported by Bruno Haible.

Signed-off-by: Eric Blake <address@hidden>
---

Not too hard, once I actually got on an AIX machine.

 ChangeLog                         |    5 +++++
 doc/posix-functions/realpath.texi |    3 +++
 m4/canonicalize.m4                |   11 ++++++++++-
 3 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 35497d0..6e466e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-06-06  Eric Blake  <address@hidden>

+       canonicalize-lgpl: work around AIX realpath bug
+       * m4/canonicalize.m4 (gl_FUNC_REALPATH_WORKS): Expose AIX bug.
+       * doc/posix-functions/realpath.texi (realpath): Document it.
+       Reported by Bruno Haible.
+
        strerror: work around FreeBSD bug
        * lib/strerror.c (strerror): Special case 0.
        Reported by Bruno Haible.
diff --git a/doc/posix-functions/realpath.texi 
b/doc/posix-functions/realpath.texi
index cc20709..fd3f160 100644
--- a/doc/posix-functions/realpath.texi
+++ b/doc/posix-functions/realpath.texi
@@ -27,6 +27,9 @@ realpath
 This function fails to recognize non-directories followed @samp{..} on
 some platforms:
 cygwin.
address@hidden
+This function misbehaves on consecutive slashes on some platforms:
+AIX 7.1.
 @end itemize

 Portability problems not fixed by Gnulib:
diff --git a/m4/canonicalize.m4 b/m4/canonicalize.m4
index 9a099bd..dffdcc3 100644
--- a/m4/canonicalize.m4
+++ b/m4/canonicalize.m4
@@ -1,4 +1,4 @@
-# canonicalize.m4 serial 19
+# canonicalize.m4 serial 20

 dnl Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.

@@ -62,10 +62,12 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
   AC_CHECK_FUNCS_ONCE([realpath])
   AC_CACHE_CHECK([whether realpath works], [gl_cv_func_realpath_works], [
     touch conftest.a
+    mkdir conftest.d
     AC_RUN_IFELSE([
       AC_LANG_PROGRAM([[
         ]GL_NOCRASH[
         #include <stdlib.h>
+        #include <string.h>
       ]], [[
         int result = 0;
         {
@@ -83,10 +85,17 @@ AC_DEFUN([gl_FUNC_REALPATH_WORKS],
           if (name != NULL)
             result |= 4;
         }
+        {
+          char *name1 = realpath (".", NULL);
+          char *name2 = realpath ("conftest.d//./..", NULL);
+          if (strcmp (name1, name2) != 0)
+            result |= 8;
+        }
         return result;
       ]])
     ], [gl_cv_func_realpath_works=yes], [gl_cv_func_realpath_works=no],
        [gl_cv_func_realpath_works="guessing no"])
+    rm -Rf conftest.a conftest.d
   ])
   if test "$gl_cv_func_realpath_works" = yes; then
     AC_DEFINE([FUNC_REALPATH_WORKS], [1], [Define to 1 if realpath()
-- 
1.7.4.4




reply via email to

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