changeset 39816:160f362b8469

doc: mention environ pitfall Based on a bug report to the Cygwin list: https://cygwin.com/ml/cygwin/2018-05/msg00321.html * doc/posix-functions/environ.texi (environ): Assigning NULL to environ is a glibc extension. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Thu, 31 May 2018 08:52:40 -0500
parents 35efeabe809f
children 1c0d31ca4c49
files ChangeLog doc/posix-functions/environ.texi
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Sep 03 21:19:16 2018 +0200
+++ b/ChangeLog	Thu May 31 08:52:40 2018 -0500
@@ -1,3 +1,9 @@
+2018-09-05  Eric Blake  <eblake@redhat.com>
+
+	doc: mention environ pitfall
+	* doc/posix-functions/environ.texi (environ): Assigning NULL to
+	environ is a glibc extension.
+
 2018-09-03  Bruno Haible  <bruno@clisp.org>
 
 	gnulib-tool: Fix build order when $testsbase is a subdir of $sourcebase.
--- a/doc/posix-functions/environ.texi	Mon Sep 03 21:19:16 2018 +0200
+++ b/doc/posix-functions/environ.texi	Thu May 31 08:52:40 2018 -0500
@@ -34,4 +34,11 @@
 @item
 The address of this variable is not a compile-time constant on some platforms:
 mingw.
+@item
+Assigning NULL to @code{environ} to clear all variables is not
+portable; better is to assign @code{environ} to one-element array
+containing a NULL pointer.  That said, an empty environment is not
+portable either, as some systems may require particular environment
+variables (such as @code{PATH}) to be present in order to operate
+consistently.
 @end itemize