autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH] docs: mention bash vs. POSIXLY_CORRECT


From: Eric Blake
Subject: [PATCH] docs: mention bash vs. POSIXLY_CORRECT
Date: Tue, 7 Sep 2010 13:51:53 -0600

* doc/autoconf.texi (Special Shell Variables) <POSIXLY_CORRECT>:
Document bash behavior.
Reported by Dustin J. Mitchell, via bug-gnulib list.

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

> Aha - bash itself is setting POSIXLY_CORRECT as a local variable upon
> 'set -o posix'; and /bin/sh (as bash) runs with 'set -o posix' already
> specified.

What's more - blindly exporting it based on whether it is set, or
blindly unsetting it, can have negative repurcussions on the rest
of an autoconf-generated script.  I'm pushing this to autoconf:

 ChangeLog         |    5 +++++
 doc/autoconf.texi |   17 +++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d43f681..5ee342f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-09-07  Eric Blake  <address@hidden>

+       docs: mention bash vs. POSIXLY_CORRECT
+       * doc/autoconf.texi (Special Shell Variables) <POSIXLY_CORRECT>:
+       Document bash behavior.
+       Reported by Dustin J. Mitchell, via bug-gnulib list.
+
        docs: enhance recommendations on test usage
        * doc/autoconf.texi (Limitations of Builtins) <test (strings)>:
        Mention yet another Solaris issue.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 4d62bf3..308fdf0 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -16416,6 +16416,23 @@ Special Shell Variables
 if you plan to use non-Posix shells to execute files.  @xref{File System
 Conventions}, for more information about @code{PATH_SEPARATOR}.

address@hidden POSIXLY_CORRECT
address@hidden POSIXLY_CORRECT
+In the GNU environment, exporting @env{POSIXLY_CORRECT} with any value
+(even empty) causes programs to try harder to conform to Posix.
+Autoconf does not directly manipulate this variable, but @command{bash}
+ties the shell variable @env{POSIXLY_CORRECT} to whether the script is
+running in Posix mode.  Therefore, take care when exporting or unsetting
+this variable, so as not to change whether @command{bash} is in Posix mode.
+
address@hidden
+$ @kbd{bash --posix -c 'set -o | grep posix}
+> @kbd{unset POSIXLY_CORRECT}
+> @kbd{set -o | grep posix'}
+posix           on
+posix           off
address@hidden example
+
 @item PWD
 @evindex PWD
 Posix 1003.1-2001 requires that @command{cd} and
-- 
1.7.2.2




reply via email to

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