From: Eric Blake Date: Tue, 14 Oct 2008 17:52:38 +0000 (-0600) Subject: Correct previous patch. X-Git-Tag: v2.63b~256 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=460ecbc03edaeaa637859e30838c5d7e96bfd36a;p=thirdparty%2Fautoconf.git Correct previous patch. * doc/autoconf.texi (Shell Functions): Bash obeys Posix, after all. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 071f2a9c..8a4504c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2008-10-14 Eric Blake + Correct previous patch. + * doc/autoconf.texi (Shell Functions): Bash obeys Posix, after + all. + Document shell function environment pitfall. * doc/autoconf.texi (Shell Functions): Document bugs in bash, Solaris /bin/sh. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index dc864626..ddd0638a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -14226,15 +14226,15 @@ and other options upon function entry and exit. Inside a function, @acronym{IRIX} sh sets @samp{$0} to the function name. It is not portable to pass temporary environment variables to shell -functions. Solaris @command{/bin/sh} does not see the variable. Meanwhile, -@command{bash} 3.2 breaks the Posix rule that the assignment must not affect -the current environment, but only when Posix compliance is requested! +functions. Solaris @command{/bin/sh} does not see the variable. +Meanwhile, not all shells follow the Posix rule that the assignment must +affect the current environment in the same manner as special built-ins. @example $ @kbd{/bin/sh -c 'func()@{ echo $a;@}; a=1 func; echo $a'} @result{} @result{} -$ @kbd{bash -c 'func()@{ echo $a;@}; a=1 func; echo $a'} +$ @kbd{ash -c 'func()@{ echo $a;@}; a=1 func; echo $a'} @result{}1 @result{} $ @kbd{bash -c 'set -o posix; func()@{ echo $a;@}; a=1 func; echo $a'}