Re: stumped on a simple autoconf/m4/sh problem

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

 



At 2024-12-02T12:55:02-0800, Paul Eggert wrote:
> On 2024-12-02 12:26, G. Branden Robinson wrote:
> > > Why shouldn't the test succeed? Solaris 10 /usr/bin/tr supports
> > > character classes like [:cntrl:].
> > It doesn't for me in the instance at gcc210.fsffrance.org.
> 
> It works for me there:
> 
>   $ uname -a
>   SunOS gcc-solaris10 5.10 Generic_Virtual sun4u sparc SUNW,SPARC-Enterprise
>   $ printf 'a\003b\n' | /usr/bin/tr '[:cntrl:]' '[ *]'
>   a b $
> 
> Solaris 10 /usr/bin/tr has trouble in multibyte locales. Perhaps
> that's your problem? 'configure' should set LC_ALL=C early on, though,
> so if this is your problem it suggests that part of your script is
> messing with the locale, when it shouldn't be.

You've put your finger on the problem!

$ locale
LANG=C
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_ALL=

However, none of my .profile, .bashrc, or .bash_profile manipulate any
locale variables.  I'm guessing ssh(1) is responsible.

This also explains why the test of `tr` behavior _passes_ when I run the
configure script, but fails when I try it at the shell prompt.

bash-3.2$ export LC_ALL=C
bash-3.2$ printf 'a\tb' | tr '[:cntrl:]' '[ *]'
a bbash-3.2$

Interestingly, if you misspell the character class (_only_ in the C
locale), you get a more helpful diagnostic--the program at least
discloses who's talking.

bash-3.2$ printf 'a\tb' | tr '[:ctrl:]' '[ *]'
tr: Bad string between [ and ].

It's still not brilliant (it could at least tell you which of the two
mandatory arguments is defective).

But what really impresses me is how someone stuck this diagnostic in at
some point, but didn't go fix this instance as part of the deal:

$ printf 'a\tb' | LC_ALL=en_US.UTF-8 tr '[:cntrl:]' '[ *]'
Bad string

That's some rock star programming, there.  Why they get the big bucks.

> I installed the attached doc patch into Autoconf master to document
> more of the tr issues.

Thanks!  I have some revisions to make to groff to work around this
misfortune.  And it looks like maybe I can get away without a new
Autoconf macro after all.  This time.  :)

I appreciate the sleuthing and Autoconf macro writing advice.

Regards,
Branden

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux