+2007-02-07 Paul Eggert <eggert@cs.ucla.edu>
+
+ * lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Prefer \r to
+ an actual carriage return. Use "ac_cr" to contain the actual
+ carriage return.
+ * doc/autoconf.texi (Limitations of Usual Tools): Document problem
+ with traditional Awk and begin.
+ * tests/torture.at (Limitations of Builtins): Document the problem
+ with Bash 2.03 printf.
+ (Substitute and define special characters):
+ Remove trailing white space. Work around a bug in Solaris 8 /bin/bash.
+
2007-02-06 Ralf Menzel <menzel@ls6.cs.uni-dortmund.de> (tiny change)
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Redirect
@c ------------------
@prindex @command{printf}
A format string starting with a @samp{-} can cause problems.
-Bash (e.g., 2.05b) interprets it as an options argument and
+Bash interprets it as an option and
gives an error. And @samp{--} to mark the end of options is not good
in the Net@acronym{BSD} Almquist shell (e.g., 0.4.6) which takes that
literally as the format string. Putting the @samp{-} in a @samp{%c}
-or @samp{%s} is probably the easiest way to avoid doubt,
+or @samp{%s} is probably easiest:
@example
printf %s -foo
@end example
+Bash 2.03 mishandles an escape sequence that happens to evaluate to @samp{%}:
+
+@example
+$ @kbd{printf '\045'}
+bash: printf: `%': missing format character
+@end example
+
@item @command{read}
@c ------------------
Aaaaarg!
@end example
+Posix says that if a program contains only @samp{BEGIN} actions, and
+contains no instances of @code{getline}, then the program merely
+executes the actions without reading input. However, traditional Awk
+implementations (such as Solaris 10 @command{awk}) read and discard
+input in this case. Portable scripts can redirect input from
+@file{/dev/null} to work around the problem. For example:
+
+@example
+awk 'BEGIN @{print "hello world"@}' </dev/null
+@end example
+
If you want your program to be deterministic, don't depend on @code{for}
on arrays:
# This file is part of Autoconf. -*- Autoconf -*-
# Parameterizing and creating config.status.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
'$ac_cs_awk_pipe_init
ac_cs_awk_pipe_fini='END { print "|#_!!_#|" }'
fi]])
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' 2>/dev/null </dev/null`
-if test "$ac_cs_awk_cr" = 'a\rb'; then ac_cs_awk_cr=; else ac_cs_awk_cr='\\'; fi
+ac_cr='\r'
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
dnl
dnl Define the pipe that does the substitution.
m4_ifdef([_AC_SUBST_FILES],
]m4_ifdef([_AC_SUBST_FILES],
[\$ac_cs_awk_pipe_fini])[
CEOF
-sed "s,\r$,,; s,\r,\$ac_cs_awk_cr&,g" < "\$tmp/subs1.awk" > "\$tmp/subs.awk"
+sed 's/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g' < "\$tmp/subs1.awk" > "\$tmp/subs.awk"
_ACEOF
]dnl end of double-quoted part
# -*- Autotest -*-
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
-# Foundation, Inc.
-#
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free
+# Software Foundation, Inc.
+
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
abc@bar @baz@baz@
abc@bar @baz@@baz@
@file@
- @file@
+ @file@
X@file@
@file@X
])
for k in 0 1 2 3 4 5 6 7; do
case $i$j$k in #(
000) ;; #(
- *) printf \\$i$j$k ;;
+ *) printf \\$i$j$k's' ;; # The 's' works around a Solaris 8 /bin/bash bug.
esac
done
done