[Top][All Lists]

[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: Gecko/20080914 Thunderbird/ Mnenhy/

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]
> 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,
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
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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