Bug 828844

Summary: grep -i (case-insensitive) is broken with UTF8
Product: [Fedora] Fedora Reporter: Jaroslav Škarvada <jskarvad>
Component: grepAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: jskarvad, kustodian, lkundrak
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 826997 Environment:
Last Closed: 2012-07-14 21:50:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jaroslav Škarvada 2012-06-05 12:55:52 UTC
+++ This bug was initially created as a clone of Bug #826997 +++

I reported this bug in the grep bug tracker, but since this is an important bug, I'm submitting it here, so it might get patched in RHEL6.

Since version 2.6.1 grep doesn't work correctly if you use a case-insesitive search with UTF8 encoding when there is an UTF8 character. Here is the example:

# Without -i switch everything works correctly
$ echo -e 'AA UTF8 char İ 12345\nAA 12345' | grep 'AA'
AA UTF8 char İ 12345
AA 12345

# With -i it breaks
$ echo -e 'AA UTF8 char İ 12345\nAA 12345' | grep -i 'AA'
AA UTF8 char İ 12345AA 12345

As you can see it somehow deletes the new line character in the line which has an UTF8 'İ' character.

Everything works correctly in versions 2.5.4 and below, it's broken from 2.6.1 to the latest version (which is atm 2.6.12) and of course it's broken in the grep-2.6.3-2.el6.x86_64.

This is a big concern, since it will break scripts which filtere UTF8 input using -i switch.

--- Additional comment from jskarvad on 2012-06-05 14:45:10 CEST ---

Thanks for reporting, clonning to Fedora.

Comment 1 Fedora Update System 2012-07-10 09:38:32 UTC
grep-2.13-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/grep-2.13-1.fc17

Comment 2 Fedora Update System 2012-07-10 20:56:22 UTC
Package grep-2.13-1.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing grep-2.13-1.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-10484/grep-2.13-1.fc17
then log in and leave karma (feedback).

Comment 3 Fedora Update System 2012-07-14 21:50:37 UTC
grep-2.13-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.