bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] unsetenv: fix OpenBSD bug


From: Eric Blake
Subject: [PATCH] unsetenv: fix OpenBSD bug
Date: Wed, 8 Sep 2010 13:54:04 -0600

* m4/setenv.m4 (gl_FUNC_UNSETENV): Check for FreeBSD bug.
* doc/posix-functions/unsetenv.texi (unsetenv): Update
documentation.
Reported by Jim Meyering.

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

> No big deal, and no rush for such a corner case...
> This certainly doesn't matter to grep.
> It failed on this line:
>   ASSERT (putenv ("") == -1);

Minor or not, the fix was easy.  In moving from 3.8 to 4.7, the
OpenBSD folks have fixed some, but not all, of the bugs that they have
in unsetenv.

 ChangeLog                         |    6 ++++++
 doc/posix-functions/unsetenv.texi |    4 ++--
 m4/setenv.m4                      |    6 ++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9fb8803..328400f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2010-09-08  Eric Blake  <address@hidden>

+       unsetenv: fix OpenBSD bug
+       * m4/setenv.m4 (gl_FUNC_UNSETENV): Check for FreeBSD bug.
+       * doc/posix-functions/unsetenv.texi (unsetenv): Update
+       documentation.
+       Reported by Jim Meyering.
+
        strtod: work around IRIX 6.5 bug
        * lib/strtod.c (strtod): Reparse number on shorter string if
        exponent parse was invalid.
diff --git a/doc/posix-functions/unsetenv.texi 
b/doc/posix-functions/unsetenv.texi
index 8a683f5..56819bb 100644
--- a/doc/posix-functions/unsetenv.texi
+++ b/doc/posix-functions/unsetenv.texi
@@ -4,7 +4,7 @@ unsetenv

 POSIX specification:@* 
@url{http://www.opengroup.org/onlinepubs/9699919799/functions/unsetenv.html}

-Gnulib module: setenv
+Gnulib module: unsetenv

 Portability problems fixed by Gnulib:
 @itemize
@@ -18,7 +18,7 @@ unsetenv
 @item
 On some platforms, this function does not fail with @samp{EINVAL} when
 passed an empty string or a string containing @samp{=}:
-FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8.
+FreeBSD 6.0, NetBSD 1.6, OpenBSD 4.7.
 @item
 This function removes only the first value association for the given
 environment variable, not all of them, on some platforms:
diff --git a/m4/setenv.m4 b/m4/setenv.m4
index 5a800d3..133f163 100644
--- a/m4/setenv.m4
+++ b/m4/setenv.m4
@@ -1,4 +1,4 @@
-# setenv.m4 serial 17
+# setenv.m4 serial 18
 dnl Copyright (C) 2001-2004, 2006-2010 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -78,7 +78,8 @@ int unsetenv();
     fi

     dnl Solaris 10 unsetenv does not remove all copies of a name.
-    AC_CACHE_CHECK([whether unsetenv works on duplicates],
+    dnl OpenBSD 4.7 unsetenv("") does not fail.
+    AC_CACHE_CHECK([whether unsetenv obeys POSIX],
       [gl_cv_func_unsetenv_works],
       [AC_RUN_IFELSE([AC_LANG_PROGRAM([[
        #include <stdlib.h>
@@ -89,6 +90,7 @@ int unsetenv();
        entry[0] = 'a';
        unsetenv ("a");
        if (getenv ("a")) return 3;
+       if (!getenv ("")) return 4;
       ]])],
       [gl_cv_func_unsetenv_works=yes], [gl_cv_func_unsetenv_works=no],
       [gl_cv_func_unsetenv_works="guessing no"])])
-- 
1.7.2.2




reply via email to

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