bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] more ports to Solaris tr, which needs [] around ranges


From: Paul Eggert
Subject: Re: [PATCH] more ports to Solaris tr, which needs [] around ranges
Date: Tue, 05 Oct 2010 17:09:45 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8

On 10/05/10 15:59, Bruno Haible wrote:
> +# Find a 'tr' program that supports character ranges in the POSIX syntax.
> +# Solaris /usr/bin/tr does not.
> +if test -f /usr/xpg6/bin/tr; then
> +  TR=/usr/xpg6/bin/tr
> +else
> +  if test -f /usr/xpg4/bin/tr; then
> +    TR=/usr/xpg4/bin/tr
> +  else
> +    TR=tr
> +  fi
> +fi

This sort of patch will work on recent-enough versions
of Solaris, but it won't work on older versions (sorry,
don't recall offhand how old).  More important, it won't work
on Solaris installations that have neither the SUNWxcu4
nor the SUNWxcu6 packages installed.

To have a greater chance of working, I suppose the code could also
test for /usr/ucb/tr (in SUNWscpu) and for /opt/sfw/bin/tr
(in SFWcoreu), but these aren't guaranteed to be present either.
/usr/ucb/tr may be a bit risky (I don't offhand recall its other
quirks).

I sympathize with the goal to separate out the nonstandard-tr
concerns from the regular programming concerns, but in this
particular case I'd say we're probably better off just living with
the system tr.  Even if we knew we could get it to work with Solaris,
there's too great a chance of running on some non-Solaris host
with this problem.

Another possibility is to spell it out, replacing this:

  libname_upper=`echo "$libname" | LC_ALL=C tr '[a-z]-' '[A-Z]_'`

with this:

  libname_upper=`echo "$libname" |
    tr abcdefghijklmnopqrstuvwxyz- \
       ABCDEFGHIJKLMNOPQRSTUVWXYZ_
  `

but that may be a cure worse than the disease.



reply via email to

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