]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* lib/autoconf/status.m4 (_AC_OUTPUT_FILES_PREPARE): Prefer \r to
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 7 Feb 2007 17:45:37 +0000 (17:45 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 7 Feb 2007 17:45:37 +0000 (17:45 +0000)
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.

ChangeLog
doc/autoconf.texi
lib/autoconf/status.m4
tests/torture.at

index 820476b1d2497e340de8e7933c5fd708c93fd207..5eb9ecfb96bc034872debf150f9b895aad5d898d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+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
index 310b9f2d9de3eed70475670aa28e7ed4cb6cccc5..7e47ee7b770c8a17329e479d54ec9c45325e065f 100644 (file)
 @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 ------------------
@@ -13009,6 +13016,17 @@ $ @kbd{gawk 'function die () @{ print "Aaaaarg!"  @}
 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:
 
index 0581fdc2ac3588ac1bc8d89b23b949bc040ed773..ebf989b26db56175448a636a810ca5e09b36e890 100644 (file)
@@ -1,7 +1,7 @@
 # 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
@@ -363,8 +363,13 @@ else
       '$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],
@@ -524,7 +529,7 @@ cat >>"\$tmp/subs1.awk" <<CEOF
 ]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
 
index 8674d1c1ab639b8bd069914709a70a4a3c6513e0..8a714a0ef9b284a603d460d16176a5f6d073740e 100644 (file)
@@ -1,8 +1,8 @@
 #                                                      -*- 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)
@@ -623,7 +623,7 @@ abc@bar @baz@baz
 abc@bar @baz@baz@
 abc@bar @baz@@baz@
 @file@
-        @file@  
+        @file@
 X@file@
 @file@X
 ])
@@ -644,7 +644,7 @@ baz=bla
       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