+2009-12-11 Eric Blake <ebb9@byu.net>
+
+ setenv: relax requirement in light of POSIX ruling
+ * m4/setenv.m4 (gl_FUNC_SETENV_SEPARATE): Test handling of "" but
+ not NULL.
+ * tests/test-setenv.c (main): Relax test.
+ * tests/test-unsetenv.c (main): Likewise.
+ * doc/posix-functions/setenv.texi (setenv): Document this.
+ * doc/posix-functions/unsetenv.texi (unsetenv): Likewise.
+
2009-12-11 Bruno Haible <bruno@clisp.org>
New module 'fd-safer-flag'.
AIX 4.3.2, HP-UX 11, IRIX 6.5, Solaris 9, mingw, BeOS.
@item
On some platforms, this function does not fail with @samp{EINVAL} when
-passed a null pointer, an empty string, or a string containing @samp{=}:
+passed an empty string or a string containing @samp{=}:
FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8, Cygwin 1.5.x.
@item
On some platforms, this function removes a leading @samp{=} from the
Portability problems not fixed by Gnulib:
@itemize
+@item
+Older versions of POSIX required that @code{setenv(NULL,"",0)} gracefully
+fail with @code{EINVAL}, but not all implementations guarantee this,
+and the requirement was removed.
@end itemize
MacOS X 10.3, FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8, OSF/1 5.1.
@item
On some platforms, this function does not fail with @samp{EINVAL} when
-passed a null pointer, an empty string, or a string containing @samp{=}:
+passed an empty string or a string containing @samp{=}:
FreeBSD 6.0, NetBSD 1.6, OpenBSD 3.8.
@item
This function removes only the first value association for the given
Portability problems not fixed by Gnulib:
@itemize
+@item
+Older versions of POSIX required that @code{unsetenv(NULL)} gracefully
+fail with @code{EINVAL}, but not all implementations guarantee this,
+and the requirement was removed.
@end itemize
-# setenv.m4 serial 13
+# setenv.m4 serial 14
dnl Copyright (C) 2001-2004, 2006-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
#include <stdlib.h>
#include <errno.h>
]], [[
- if (setenv (NULL, "", 0) != -1) return 1;
+ if (setenv ("", "", 0) != -1) return 1;
if (errno != EINVAL) return 2;
if (setenv ("a", "=", 1) != 0) return 3;
if (strcmp (getenv ("a"), "=") != 0) return 4;
errno = 0;
ASSERT (setenv ("a=b", "", 0) == -1);
ASSERT (errno == EINVAL);
+#if 0
+ /* glibc and gnulib's implementation guarantee this, but POSIX no
+ longer requires it: http://austingroupbugs.net/view.php?id=185 */
errno = 0;
ASSERT (setenv (NULL, "", 0) == -1);
ASSERT (errno == EINVAL);
+#endif
return 0;
}
errno = 0;
ASSERT (unsetenv ("a=b") == -1);
ASSERT (errno == EINVAL);
+#if 0
+ /* glibc and gnulib's implementation guarantee this, but POSIX no
+ longer requires it: http://austingroupbugs.net/view.php?id=185 */
errno = 0;
ASSERT (unsetenv (NULL) == -1);
ASSERT (errno == EINVAL);
+#endif
return 0;
}