[master] grep -i fails to work on intrepid

Bug #241990 reported by Duncan Sands
34
Affects Status Importance Assigned to Milestone
grep (Debian)
Fix Released
Undecided
Unassigned
grep (Ubuntu)
Fix Released
High
Martin Pitt
Intrepid
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: grep

Hardy Heron (correct):

$ echo A | grep -i a
A

Intrepid Ibis (wrong):

$ echo A | grep -i a
$

Same if you grep a file containing A.
This is GNU grep 2.5.3.

Tags: metabug

Related branches

Revision history for this message
brianhanna (brianhanna) wrote :

I can confirm the bug

Revision history for this message
Javier Noval (javiernoval) wrote :

I can confirm this bug happens in UTF-8 locales.

This case fails:
$ echo Y | LC_ALL=en_US.UTF-8 grep -i '[y]'
$

And this one works as expected:
$ echo Y | LC_ALL=C grep -i '[y]'
Y
$

The patch 66-match_icase.patch is supposed to make the case-insensitive searches work in non-UTF-8 locales, but it appears not to be working (maybe it's not being applied at all?).

Revision history for this message
Steven Shiau (stevenshiau) wrote :

I confirm this bug in 8.10 alpha1, too.
It was working in Ubuntu 8.04.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

Confirming, regarding all the comments above.

black:~$ lsb_release -rd
Description: Ubuntu intrepid (development branch)
Release: 8.10
black:~$ apt-cache policy grep
grep:
  Installed: 2.5.3~dfsg-5ubuntu1
  Candidate: 2.5.3~dfsg-5ubuntu1

Changed in grep:
status: New → Confirmed
Revision history for this message
nine (niin-deactivatedaccount-deactivatedaccount) wrote :

The patch mentioned in comment 2 is applied (according to the buildlog: http://launchpadlibrarian.net/15408026/buildlog_ubuntu-intrepid-i386.grep_2.5.3~dfsg-5ubuntu1_FULLYBUILT.txt.gz).

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

It took me some time but here I am. This problem is related to grep _and_ the version of libc6.

For some reason, in Intrepid with libc6-dev 2.8 the macro __USE_GNU is not defined in /usr/include/regex.h . Then, the configure script fails to test the libc regex, and grep is build using the internal regex library (the one shipped with grep). This library seems to be quite broken when it comes to deal with multibytes strings and ignore case options. It doesn't even compile when you're forcing multibyte support.

This is confirmed by the fact that "grep" builds and works fine on debian/sid and that the strictly same package (the debian source) build on Ubuntu shows the ignorecase issue.

Then the easiest thing to do is to define the macro _GNU_SOURCE to force the use of the libc regex.

A proposition of patch is attached.

Can someone review it ?

Thanks.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for debugging this! I'll apply this or a similar change soon.

Changed in grep:
assignee: nobody → pitti
status: Confirmed → In Progress
Matt Zimmerman (mdz)
Changed in grep:
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grep - 2.5.3~dfsg-5ubuntu2

---------------
grep (2.5.3~dfsg-5ubuntu2) intrepid; urgency=low

  * debian/rules: Configure with --without-included-regex, so that the
    broken configure test does not erroneously think that our glibc doesn't
    support regexes. (It fails to use _GNU_SOURCE in configure). The internal
    one is broken and e. g. does not work with "grep -i". Thanks to
    Jean-Baptiste Lallement for tracking this down! (LP: #241990)

 -- Martin Pitt <email address hidden> Thu, 17 Jul 2008 10:43:28 +0100

Changed in grep:
status: In Progress → Fix Released
Changed in grep:
status: Unknown → New
Revision history for this message
nine (niin-deactivatedaccount-deactivatedaccount) wrote :

The grep package failed to authenticate when I updated my Intrepid host just now. The 92 other packages didn't :) , so I'm pretty sure it's grep.

Revision history for this message
nine (niin-deactivatedaccount-deactivatedaccount) wrote :

Please ignore my previous comment.

Revision history for this message
Artur Rona (ari-tczew) wrote :

 grep (2.5.4-3) unstable; urgency=low

   * Updated copyright. The grep.texi removal notice is not longer
     needed.
   * Adding --without-included-regex to solve problems with glibc-2.9.
     Thanks to the Ubuntu team. (Closes: #491158)
   * Updated debhelper compat to version 7

 -- Santiago Ruano Rincón <email address hidden> Mon, 09 Mar 2009 22:50:47 +0100

Changed in grep (Debian):
importance: Unknown → Undecided
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.