autoconf-commit
[Top][All Lists]
Advanced

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

[SCM] GNU Autoconf source repository branch, master, updated. v2.67-11-g


From: Eric Blake
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.67-11-g5adc15b
Date: Tue, 03 Aug 2010 22:21:37 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Autoconf source repository".

http://git.sv.gnu.org/gitweb/?p=autoconf.git;a=commitdiff;h=5adc15b7b64622cf6f7f76e8b6f5cbde4be82851

The branch, master has been updated
       via  5adc15b7b64622cf6f7f76e8b6f5cbde4be82851 (commit)
       via  608c89c8c6547885d571780852c9613f3948737f (commit)
      from  114dc91c10feb055162f3bee85330acd31ed50fc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5adc15b7b64622cf6f7f76e8b6f5cbde4be82851
Author: Eric Blake <address@hidden>
Date:   Tue Aug 3 15:56:07 2010 -0600

    docs: mention bash bug with word splitting
    
    * doc/autoconf.texi (Shell Substitutions): Document bash bug, and
    zsh default behavior difference.
    Reported by Ralf Wildenhues.

commit 608c89c8c6547885d571780852c9613f3948737f
Author: Eric Blake <address@hidden>
Date:   Tue Aug 3 15:40:16 2010 -0600

    docs: mention ksh bug with function syntax
    
    * doc/autoconf.texi (Shell Functions): Document ksh93 limitation.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog         |   10 +++++++++
 doc/autoconf.texi |   54 ++++++++++++++++++++++++++++++++++++++++++++++------
 2 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2cbd690..7184742 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-03  Eric Blake  <address@hidden>
+
+       docs: mention bash bug with word splitting
+       * doc/autoconf.texi (Shell Substitutions): Document bash bug, and
+       zsh default behavior difference.
+       Reported by Ralf Wildenhues.
+
+       docs: mention ksh bug with function syntax
+       * doc/autoconf.texi (Shell Functions): Document ksh93 limitation.
+
 2010-08-03  Ralf Wildenhues  <address@hidden>
 
        Fix typo in Autotest color test, for dash testsuite failure.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index df0e298..b7e2c19 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -15283,6 +15283,32 @@ $ @kbd{echo "`echo \"hello\"`"}
 There is just no portable way to use double-quoted strings inside
 double-quoted back-quoted expressions (pfew!).
 
+Bash 4.1 has a bug where quoted empty strings adjacent to unquoted
+parameter expansions are elided during word splitting.  Meanwhile, zsh
+does not perform word splitting except when in Bourne compatibility
+mode.  In the example below, the correct behavior is to have five
+arguments to the function, and exactly two spaces on either side of the
+middle @samp{-}, since word splitting collapses multiple spaces in
address@hidden but leaves empty arguments intact.
+
address@hidden
+$ @kbd{bash -c 'n() @{ echo "$#$@@"; @}; f="  -  "; n - ""$f"" -'}
+3- - -
+$ @kbd{ksh -c 'n() @{ echo "$#$@@"; @}; f="  -  "; n - ""$f"" -'}
+5-  -  -
+$ @kbd{zsh -c 'n() @{ echo "$#$@@"; @}; f="  -  "; n - ""$f"" -'}
+3-   -   -
+$ @kbd{zsh -c 'emulate sh;}
+> @kbd{n() @{ echo "$#$@@"; @}; f="  -  "; n - ""$f"" -'}
+5-  -  -
address@hidden example
+
address@hidden
+You can work around this by doing manual word splitting, such as using
address@hidden"$str" $list} rather than @samp{"$str"$list}.
+
+There are also portability pitfalls with particular expansions:
+
 @table @code
 @item $@@
 @cindex @samp{"$@@"}
@@ -16202,6 +16228,20 @@ hence read-only.  Do not use it.
 Nowadays, it is difficult to find a shell that does not support
 shell functions at all.  However, some differences should be expected.
 
+When declaring a shell function, you must include whitespace between the
address@hidden)} after the function name and the start of the compound
+expression, to avoid upsetting @command{ksh}.  While it is possible to
+use any compound command, most scripts use @address@hidden@address@hidden
+
address@hidden
+$ @kbd{/bin/sh -c 'a()@{ echo hi;@}; a'}
+hi
+$ @kbd{ksh -c 'a()@{ echo hi;@}; a'}
+ksh: syntax error at line 1: address@hidden' unexpected
+$ @kbd{ksh -c 'a() @{ echo hi;@}; a'}
+hi
address@hidden example
+
 Inside a shell function, you should not rely on the error status of a
 subshell if the last command of that subshell was @code{exit} or
 @code{trap}, as this triggers bugs in zsh 4.x; while Autoconf tries to
@@ -16213,10 +16253,10 @@ function.  This has the effect that using a function 
as the first
 command in a @command{trap} handler can cause problems.
 
 @example
-$ @kbd{bash -c 'foo()@{ echo $?; @}; trap foo 0; (exit 2); exit 2'; echo $?}
+$ @kbd{bash -c 'foo() @{ echo $?; @}; trap foo 0; (exit 2); exit 2'; echo $?}
 2
 2
-$ @kbd{ash -c 'foo()@{ echo $?; @}; trap foo 0; (exit 2); exit 2'; echo $?}
+$ @kbd{ash -c 'foo() @{ echo $?; @}; trap foo 0; (exit 2); exit 2'; echo $?}
 0
 2
 @end example
@@ -16231,8 +16271,8 @@ Not all shells treat shell functions as simple commands 
impacted by
 @samp{set -e}, for example with Solaris 10 @command{bin/sh}:
 
 @example
-$ @kbd{bash -c 'f()@{ return 1; @}; set -e; f; echo oops}
-$ @kbd{/bin/sh -c 'f()@{ return 1; @}; set -e; f; echo oops}
+$ @kbd{bash -c 'f() @{ return 1; @}; set -e; f; echo oops}
+$ @kbd{/bin/sh -c 'f() @{ return 1; @}; set -e; f; echo oops}
 oops
 @end example
 
@@ -16259,13 +16299,13 @@ 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'}
+$ @kbd{/bin/sh -c 'func() @{ echo $a;@}; a=1 func; echo $a'}
 @result{}
 @result{}
-$ @kbd{ash -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'}
+$ @kbd{bash -c 'set -o posix; func() @{ echo $a;@}; a=1 func; echo $a'}
 @result{}1
 @result{}1
 @end example


hooks/post-receive
-- 
GNU Autoconf source repository



reply via email to

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