]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* doc/autoconf.texi (Making testsuite Scripts): Document
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Tue, 13 Nov 2007 07:30:58 +0000 (23:30 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 13 Nov 2007 07:30:58 +0000 (23:30 -0800)
":;{" shorthand as in previous patch.

2007-11-12  Paul Eggert  <eggert@cs.ucla.edu>

* doc/autoconf.texi (Limitations of Builtins): Document problem
with { ... } a bit more clearly.  Suggest ":;{" as a shorthand
for the workaround.
* lib/m4sugar/Makefile.am (version.m4): Detect 'echo' failure.
Use ":;{" shorthand.
* tests/Makefile.am ($(srcdir)/package.m4): Likewise.

ChangeLog
doc/autoconf.texi
lib/m4sugar/Makefile.am
tests/Makefile.am

index 6b95b48a0880cc4c0f899c5d14375a8529ac6e94..14262785335759d05ddbbba547c50c49204b7032 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2007-11-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * doc/autoconf.texi (Making testsuite Scripts): Document
+       ":;{" shorthand as in previous patch.
+
+2007-11-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * doc/autoconf.texi (Limitations of Builtins): Document problem
+       with { ... } a bit more clearly.  Suggest ":;{" as a shorthand
+       for the workaround.
+       * lib/m4sugar/Makefile.am (version.m4): Detect 'echo' failure.
+       Use ":;{" shorthand.
+       * tests/Makefile.am ($(srcdir)/package.m4): Likewise.
+
 2007-11-12  Jim Meyering  <meyering@redhat.com>
 
        Add more non-srcdir build support.
index acc80cf43c1a1676240ba768857e547a4fc2c238..8633fa2cf5389c299821027bfbddfa83465ef9ec 100644 (file)
@@ -13572,11 +13572,10 @@ if @var{command}; then (exit 1); else :; fi
 @item @command{@{...@}}
 @c --------------------
 @prindex @command{@{...@}}
-As recently as GNU Bash 3.2, some shells do not properly set @samp{$?}
-when failing to write redirected output of any compound command other
-than a subshell group, when that compound command is the first thing
-executed.  This is most commonly observed with @{...@}, but also affects
-other compound commands.
+Bash 3.2 (and earlier versions) sometimes does not properly set
+@samp{$?} when failing to write redirected output of a compound command.
+This problem is most commonly observed with @samp{@{@dots{}@}}; it does
+not occur with @samp{(@dots{})}.  For example:
 
 @example
 $ @kbd{bash -c '@{ echo foo; @} >/bad; echo $?'}
@@ -13587,14 +13586,10 @@ bash: line 1: /bad: Permission denied
 0
 @end example
 
-The workaround is simple: prime bash with a simple command before any
-compound command with redirection.
+To work around the bug, prepend @samp{:;}:
 
 @example
-$ @kbd{bash -c ':; @{ echo foo; @} >/bad; echo $?'}
-bash: line 1: /bad: Permission denied
-1
-$ @kbd{bash -c ':; while :; do echo; done >/bad; echo $?'}
+$ @kbd{bash -c ':;@{ echo foo; @} >/bad; echo $?'}
 bash: line 1: /bad: Permission denied
 1
 @end example
@@ -20239,13 +20234,14 @@ we suggest that you also define @code{AT_PACKAGE_NAME},
 suggest the following makefile excerpt:
 
 @smallexample
+# The `:;' works around a Bash 3.2 bug when the output is not writeable.
 $(srcdir)/package.m4: $(top_srcdir)/configure.ac
-        @{                                      \
-          echo '# Signature of the current package.'; \
-          echo 'm4_define([AT_PACKAGE_NAME],      [@@PACKAGE_NAME@@])'; \
-          echo 'm4_define([AT_PACKAGE_TARNAME],   [@@PACKAGE_TARNAME@@])'; \
-          echo 'm4_define([AT_PACKAGE_VERSION],   [@@PACKAGE_VERSION@@])'; \
-          echo 'm4_define([AT_PACKAGE_STRING],    [@@PACKAGE_STRING@@])'; \
+        :;@{ \
+          echo '# Signature of the current package.' && \
+          echo 'm4_define([AT_PACKAGE_NAME],      [@@PACKAGE_NAME@@])' && \
+          echo 'm4_define([AT_PACKAGE_TARNAME],   [@@PACKAGE_TARNAME@@])' && \
+          echo 'm4_define([AT_PACKAGE_VERSION],   [@@PACKAGE_VERSION@@])' && \
+          echo 'm4_define([AT_PACKAGE_STRING],    [@@PACKAGE_STRING@@])' && \
           echo 'm4_define([AT_PACKAGE_BUGREPORT], [@@PACKAGE_BUGREPORT@@])'; \
         @} >'$(srcdir)/package.m4'
 @end smallexample
index de329076b235e1193309f84fd0b60c659357eb81..7360ca101153dca0fa6428d06fe7a6cecd390857 100644 (file)
@@ -26,17 +26,16 @@ CLEANFILES = $(nodist_m4sugarlib_DATA)
 
 # The `:;' works around a redirected compound command bash exit status bug.
 version.m4: $(top_srcdir)/configure.ac
-       :; \
-       {                                       \
-         echo '# This file is part of -*- Autoconf -*-.'; \
-         echo '# Version of Autoconf.'; \
-         echo '# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007'; \
-         echo '# Free Software Foundation, Inc.'; \
-         echo ;\
-         echo 'm4_define([m4_PACKAGE_NAME],      [$(PACKAGE_NAME)])'; \
-         echo 'm4_define([m4_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])'; \
-         echo 'm4_define([m4_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])'; \
-         echo 'm4_define([m4_PACKAGE_STRING],    [$(PACKAGE_STRING)])'; \
+       :;{ \
+         echo '# This file is part of -*- Autoconf -*-.' && \
+         echo '# Version of Autoconf.' && \
+         echo '# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2007' && \
+         echo '# Free Software Foundation, Inc.' && \
+         echo  &&\
+         echo 'm4_define([m4_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
+         echo 'm4_define([m4_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
+         echo 'm4_define([m4_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
+         echo 'm4_define([m4_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
          echo 'm4_define([m4_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
        } >version.m4
 
index aa43da6b62ab90f193be21846eb42e04d5b4af6f..4cf7fd10bc21b9c3fa0d868014bde6cd532290ec 100644 (file)
@@ -36,13 +36,12 @@ include ../lib/freeze.mk
 
 # The `:;' works around a redirected compound command bash exit status bug.
 package.m4: Makefile
-       :; \
-       {                                       \
-         echo '# Signature of the current package.'; \
-         echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])'; \
-         echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])'; \
-         echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])'; \
-         echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])'; \
+       :;{ \
+         echo '# Signature of the current package.' && \
+         echo 'm4_define([AT_PACKAGE_NAME],      [$(PACKAGE_NAME)])' && \
+         echo 'm4_define([AT_PACKAGE_TARNAME],   [$(PACKAGE_TARNAME)])' && \
+         echo 'm4_define([AT_PACKAGE_VERSION],   [$(PACKAGE_VERSION)])' && \
+         echo 'm4_define([AT_PACKAGE_STRING],    [$(PACKAGE_STRING)])' && \
          echo 'm4_define([AT_PACKAGE_BUGREPORT], [$(PACKAGE_BUGREPORT)])'; \
        } > $@-t
        mv $@-t $@