":;{" 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 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.
@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 $?'}
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
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
# 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
# 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 $@