bug-standards
[Top][All Lists]
Advanced

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

Re: Add tr to common programs


From: Eric Blake
Subject: Re: Add tr to common programs
Date: Tue, 04 Nov 2008 19:50:17 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Karl Berry on 11/4/2008 4:33 PM:

Hi Karl, Ralf,

>     A bug report on the autoconf list recently reported that autoconf has been
>     producing configure files for several years now with a dependence on
>     tr[1]
>     [1] http://lists.gnu.org/archive/html/autoconf/2008-10/msg00124.html
> 
> The config.status for texinfo uses tr in one place, as far as I can see:
> 
>       expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
>
> Not for $as_cr as your message suggests.  Is that a recent change?
> Are there other uses?

On a whim, I picked ftp://ftp.gnu.org/pub/gnu/texinfo/texinfo-4.5.tar.gz,
dating back to 2/15/2004.

$ grep -n ' tr ' texinfo-4.5/configure
5576:      jm_tr_func=HAVE_DECL_`echo $jm_func | tr
abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
8370:    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
9333:    am_cv_proto_iconv=`echo "$am_cv_proto_iconv" | tr -s ' ' | sed -e
's/( /(/'`

In other words, tr has been used in configure scripts long before this
particular autoconf patch to config.status.  It was just that this recent
patch raised the issue of whether tr should be used at all.

> 
> Anyway, I am surprised that your experience is that tr is more portable
> than awk for this.  I've never thought that \r and the like were
> portable across tr's, although I haven't made a study of it lately.

Nope, \r is not portable to Solaris /usr/ucb/tr.  \015 is portable,
however (even in EBCDIC, it still resolves to carriage return); in
Autoconf's particular use-case of \015, with $as_cr, the script
intentionally decays to a no-op replacement if \015 is not carriage return
due to some other weird encoding.

>  If
> \r is not portable across awk's, how about \015?  It is hard to imagine
> an awk that doesn't support that ...

The whole reason that autoconf recently had to add support for tr \015 is
that we already had problems trying either \015 or \r in awk.  And literal
^M in the file was also problematic.

> 
> Adding tr for the sake of this one small task seems a bit troublesome to
> me, per Ralf's mail.  Not that I'm saying no, but let's discuss ...

It's used in multiple contexts in configure scripts.  Gnulib has several
macros that assume tr availability.

As for concerns about portability issues, all of the issues listed in the
common tools have portability issues.  I don't see any reason to single
out tr as different from the rest, but wouldn't mind seeing a disclaimer
pointing to the autoconf manual on common tool portability issues.

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

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

iEYEARECAAYFAkkRCekACgkQ84KuGfSFAYCiMgCgmGFQfqso4symA2uqwVDA09cU
TnwAmgID/kk4F/PP85E26jl2nPYix0LC
=Twl1
-----END PGP SIGNATURE-----




reply via email to

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