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.69-68-g


From: Gary V. Vaughan
Subject: [SCM] GNU Autoconf source repository branch, master, updated. v2.69-68-g2b59b6f
Date: Tue, 29 Jan 2013 09:49:02 +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=2b59b6f8a79b8bf77e178ff4e5aa0ede433d39cf

The branch, master has been updated
       via  2b59b6f8a79b8bf77e178ff4e5aa0ede433d39cf (commit)
      from  bea5177adc0c924fe7483509a5e38a6d49319fcb (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 2b59b6f8a79b8bf77e178ff4e5aa0ede433d39cf
Author: Gary V. Vaughan <address@hidden>
Date:   Mon Jan 28 10:44:45 2013 +0700

    m4sugar: factor away _AS_ECHO_PREPARE.
    
    "printf '%s\n' ..." has been a fine replacement for plain "echo"
    for at least 5 years (probably more like 10), even with most
    museum-piece shells.
    * lib/m4sugar/m4sh.m4 (_AS_ECHO_PREPARE): Remove.
    (_AS_SHELL_SANITIZE): Keep as_nl setting originally from
    _AS_ECHO_PREPARE here where it more properly belongs.
    (AS_ECHO, AS_ECHO_N): Use printf unconditionally.
    * doc/autoconf.texi (Limitations of Shell Builtins): Document
    preference for 'printf' over working around 'echo' bugs.
    * NEWS: Updated.
    Reported by Jim Meyering.

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

Summary of changes:
 NEWS                |    4 +++
 doc/autoconf.texi   |   19 ++++++---------
 lib/m4sugar/m4sh.m4 |   60 ++++++---------------------------------------------
 3 files changed, 19 insertions(+), 64 deletions(-)

diff --git a/NEWS b/NEWS
index 974d48d..35e7b88 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@ GNU Autoconf NEWS - User visible changes.
 ** Older version of automake and aclocal (< 1.8) are no longer supported
    by autoreconf.
 
+** Use of printf is now recommended instead of working around bugs in
+   echo.  Macros AS_ECHO and AS_ECHO_N now expand unconditionally to
+   "printf '%s\n'" and "printf %s".
+
 ** Macros
 
 - New macro AC_C__GENERIC.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index 2d6d866..c95d871 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -17522,12 +17522,14 @@ characters to @command{echo}.  For example, 
@samp{echo "$foo"} is safe
 only if you know that @var{foo}'s value cannot contain backslashes and
 cannot start with @samp{-}.
 
-If this may not be true, @command{printf} is in general safer and
-easier to use than @command{echo} and @command{echo -n}.  Thus, scripts
-where portability is not a major concern should use @command{printf
-'%s\n'} whenever @command{echo} could fail, and similarly use
address@hidden %s} instead of @command{echo -n}. For portable shell
-scripts, instead, it is suggested to use a here-document like this:
+Normally, @command{printf} is safer and easier to use than @command{echo}
+and @command{echo -n}.  Thus, you should use @command{printf '%s\n'}
+instead of @command{echo}, and similarly use @command{printf %s} instead
+of @command{echo -n}.
+
+Older scripts, written before @command{printf} was portable,
+sometimes used a here-document as a safer alternative to @command{echo},
+like this:
 
 @example
 cat <<EOF
@@ -17535,11 +17537,6 @@ $foo
 EOF
 @end example
 
-Alternatively, M4sh provides @code{AS_ECHO} and @code{AS_ECHO_N} macros
-which choose between various portable implementations: @samp{echo}
-or @samp{print} where they work, @command{printf} if it is available,
-or else other creative tricks in order to work around the above problems.
-
 
 @item @command{eval}
 @c -----------------
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 25b4fe3..479c2d9 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -453,7 +453,6 @@ m4_defun([_AS_SHELL_SANITIZE],
 [m4_text_box([M4sh Initialization.])
 
 AS_BOURNE_COMPATIBLE
-_AS_ECHO_PREPARE
 _AS_PATH_SEPARATOR_PREPARE
 
 # IFS
@@ -461,6 +460,9 @@ _AS_PATH_SEPARATOR_PREPARE
 # there to prevent editors from complaining about space-tab.
 # (If _AS_PATH_WALK were called with IFS unset, it would disable word
 # splitting by setting IFS to empty value.)
+as_nl='
+'
+export as_nl
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
@@ -1023,63 +1025,15 @@ fi
 # Output WORD followed by a newline.  WORD must be a single shell word
 # (typically a quoted string).  The bytes of WORD are output as-is, even
 # if it starts with "-" or contains "\".
-m4_defun_init([AS_ECHO],
-[AS_REQUIRE([_$0_PREPARE])],
-[$as_echo $1])
+m4_defun([AS_ECHO],
+[printf '%s\n' $1])
 
 
 # AS_ECHO_N(WORD)
 # ---------------
 # Like AS_ECHO(WORD), except do not output the trailing newline.
-m4_defun_init([AS_ECHO_N],
-[AS_REQUIRE([_AS_ECHO_PREPARE])],
-[$as_echo_n $1])
-
-
-# _AS_ECHO_PREPARE
-# ----------------
-# Arrange for $as_echo 'FOO' to echo FOO without escape-interpretation;
-# and similarly for $as_echo_n, which omits the trailing newline.
-# 'FOO' is an optional single argument; a missing FOO is treated as empty.
-m4_defun([_AS_ECHO_PREPARE],
-[[as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
-    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='print -r --'
-  as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
-  as_echo='printf %s\n'
-  as_echo_n='printf %s'
-else
-  if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; 
then
-    as_echo_body='eval /usr/ucb/echo -n "$][1$as_nl"'
-    as_echo_n='/usr/ucb/echo -n'
-  else
-    as_echo_body='eval expr "X$][1" : "X\\(.*\\)"'
-    as_echo_n_body='eval
-      arg=$][1;
-      case $arg in @%:@(
-      *"$as_nl"*)
-       expr "X$arg" : "X\\(.*\\)$as_nl";
-       arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
-      esac;
-      expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
-    '
-    export as_echo_n_body
-    as_echo_n='sh -c $as_echo_n_body as_echo'
-  fi
-  export as_echo_body
-  as_echo='sh -c $as_echo_body as_echo'
-fi
-]])# _AS_ECHO_PREPARE
+m4_defun([AS_ECHO_N],
+[printf %s $1])
 
 
 # AS_TEST_X


hooks/post-receive
-- 
GNU Autoconf source repository



reply via email to

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