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.63-139-


From: Eric Blake
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.63-139-ga78b497
Date: Thu, 30 Oct 2008 13:42:40 +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=a78b49741374d1f4f18fc6f19158c346caad36cf

The branch, master has been updated
       via  a78b49741374d1f4f18fc6f19158c346caad36cf (commit)
      from  c55740c46308374b1dfdd11a789e3fea70eedf39 (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 a78b49741374d1f4f18fc6f19158c346caad36cf
Author: Eric Blake <address@hidden>
Date:   Thu Oct 30 06:56:44 2008 -0600

    Work around Solaris /bin/sh case bug.
    
    * lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT): Always provide
    a non-empty command list.
    (AS_CASE): Always guarantee that a case will match.
    * doc/autoconf.texi (Limitations of Builtins) <case>: Document the
    Solaris bug, and mention AS_CASE.
    
    Signed-off-by: Eric Blake <address@hidden>

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

Summary of changes:
 ChangeLog           |    9 +++++++++
 doc/autoconf.texi   |   13 +++++++++++++
 lib/m4sugar/m4sh.m4 |   11 +++++++----
 3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8d2cd25..e19a3f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-10-30  Eric Blake  <address@hidden>
+
+       Work around Solaris /bin/sh case bug.
+       * lib/m4sugar/m4sh.m4 (_AS_CASE, _AS_CASE_DEFAULT): Always provide
+       a non-empty command list.
+       (AS_CASE): Always guarantee that a case will match.
+       * doc/autoconf.texi (Limitations of Builtins) <case>: Document the
+       Solaris bug, and mention AS_CASE.
+
 2008-10-30  Paolo Bonzini  <address@hidden>
 
        Require _AS_CR_PREPARE where appropriate.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 1a2f748..d2997ef 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -14842,6 +14842,19 @@ ash-0.3.8 $ @kbd{case foo in esac;}
 @error{}Syntax error: ";" unexpected (expecting ")")
 @end example
 
+Posix requires @command{case} to give an exit status of 0 if no cases
+match.  However, @command{/bin/sh} in Solaris 10 does not obey this
+rule.  Meanwhile, it is unclear whether a case that matches, but
+contains no statements, must also change the exit status to 0.  The M4sh
+macro @code{AS_CASE} works around these inconsistencies.
+
address@hidden
+$ @kbd{bash -c 'case `false` in ?) ;; esac; echo $?'}
+0
+$ @kbd{/bin/sh -c 'case `false` in ?) ;; esac; echo $?'}
+255
address@hidden example
+
 
 @item @command{cd}
 @c ---------------
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index a67c30d..1f1f599 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -492,16 +492,19 @@ _AS_UNSET_PREPARE
 # |   *) DEFAULT ;;
 # | esac
 # The shell comments are intentional, to work around people who don't
-# realize the impacts of using insufficient m4 quoting.
+# realize the impacts of using insufficient m4 quoting.  This macro
+# always provides a default case, to work around a Solaris /bin/sh
+# bug regarding the exit status when no case matches.
 m4_define([_AS_CASE],
 [ address@hidden:@(]
-  $1[)] $2 ;;])
+  $1[)] m4_default([$2], [:]) ;;])
 m4_define([_AS_CASE_DEFAULT],
 [ address@hidden:@(]
-  *[)] $1 ;;])
+  *[)] m4_default([$1], [:]) ;;])
 
 m4_defun([AS_CASE],
-[case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT], m4_shift($@))
+[case $1 in[]m4_map_args_pair([_$0], [_$0_DEFAULT],
+   m4_shift(address@hidden(m4_eval([$# & 1]), [1], [,])))
 esac])# AS_CASE
 
 


hooks/post-receive
--
GNU Autoconf source repository




reply via email to

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