Subject: bug#15527: Failing test spencer1-locale for grep 2.14 on Solaris

From: Jim Meyering <[email-masked]>
Date: Tue, 15 Oct 2013 21:48:48 -0700

close 15527
thanks

Thanks, Dagobert.
I have reproduced the problem with stock grep-2.14.  On this system:
  SunOS unstable10s 5.10 Generic_147440-27 sun4v sparc
SUNW,SPARC-Enterprise-T5220,
this command prints nothing and exits with status 1:

  printf 'a\002c\n' | LC_COLLATE=ru_RU.KOI8-R ./grep -E "$(printf
'a[\001-\003]?c')"

Why? Debugging showed that deep in the guts of lib/regcomp.c, we would
call wcscoll and determine that while \001 and \003 are part of the
range in question, \002 is not.  But only when using the collating
sequence of that particular locale.

I confirmed that we can work around the problem by telling configure
to use gnulib's replacement wcscoll function (by pretending it is
absent), like this:

  ac_cv_func_wcscoll=no ./configure

With that, all tests passed.

When I went to fix this by adding an autoconf test to detect the
broken wcscoll, and to provide sensible fallback when cross-compiling,
I realized that at least for grep, such a fix is no longer needed,
since all uses of wcscoll have been removed from gnulib's regcomp.c,
by this change:

commit 6410c7a6ea65cceb588aadb497715279d4ec5daa
Author: Paul Eggert <[email-masked]>
Date:   Sat Dec 29 23:31:08 2012 -0800

    regex: implement rational ranges

    Reported by Aharon Robbins in
    <http://sourceware.org/ml/libc-alpha/2012-12/msg00456.html>.
    * lib/regcomp.c (build_range_exp) [!_LIBC]:
    * lib/regexec.c (check_node_accept_bytes) [!_LIBC]:
    Implement rational ranges.

Then, I confirmed that when using a grep tarball built from the latest
in git, all tests pass, too.

Thank you Paul and Arnold/Aharon.