[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in gnulib-tools prevents bison from bootstrapping

From: Eric Blake
Subject: Re: Bug in gnulib-tools prevents bison from bootstrapping
Date: Fri, 22 Jun 2007 22:20:02 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20070509 Thunderbird/ Mnenhy/

Hash: SHA1

According to Bruno Haible on 6/22/2007 8:30 PM:
> It is generally impossible to write reliable shell-scripts using 'echo',
> when this 'echo' commands interprets backslahes. I'm not inclined to check
> or rewrite the 500 echo commands in gnulib-tool. Instead, I'm applying this
> workaround. Tested with bash, zsh, ksh, and /bin/sh of Linux, MacOS X,
> AIX, HP-UX, IRIX, Solaris, OSF/1.

POSIX requires that echo interpret backslash sequences.  Using echo with
backslashes is flat out not portable, because of the argument over whether
shells should comply to POSIX or continue to support current usage with \
uninterpreted.  POSIX even admits this, and recommends the use of printf

> libtool.m4 also tries other workarounds: searching for an 'echo' program
> in $PATH:/usr/ucb (but how is this better than 'cat'?) or using a built-in
> 'print -r' command (which shells except ksh have this?) or using 'printf'
> (is that portable nowadays?).

printf is not yet universally portable, but at least it is a shell builtin
on many common shells (but notably not a builtin in Solaris' /bin/sh).
Since forking external programs matters most on cygwin and mingw, where
printf is always available as a builtin, it is one of the lightest-weight
alternatives to echo when you are worried about the number of processes.

> 2007-06-22  Bruno Haible  <address@hidden>
>       * gnulib-tool (echo): Ensure the echo primitive does not interpret
>       backslashes.
>       * tests/test-echo.sh: New file.

While I admire your patch for trying to find reliable behavior, I have to
question whether it right to demand non-POSIX behavior of all platforms.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


reply via email to

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