buggrep - Bugs: bug #36567, grep -i (case-insensitive) is...


You are not allowed to post comments on this tracker with your current authentication level.

bug #36567: grep -i (case-insensitive) is broken with UTF8

Submitter:  Strahinja Kustudic <kustodian>
Submitted:  Thu 31 May 2012 11:18:30 AM UTC
Category:  None Severity:  4 - Important
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Tue 12 Jun 2012 04:49:54 PM UTC, comment #5: 

I've pushed the patch (with one minor further change) and am marking this bug as fixed.

Paul Eggert <eggert>
Group Member
Tue 12 Jun 2012 04:01:56 PM UTC, comment #4: 

Whoops, sent the wrong patch; here's the corrected one.

(file #26010)

Paul Eggert <eggert>
Group Member
Tue 12 Jun 2012 03:50:22 PM UTC, comment #3: 

I'm attaching a further fix, to fix a problem reported today about the installed patch.

(file #26009)

Paul Eggert <eggert>
Group Member
Fri 01 Jun 2012 08:44:06 AM UTC, comment #2: 

Thank you very much for the fast response. I was stunned to see this problem not being reported earlier, especially since the last 6 versions have it.

Strahinja Kustudic <kustodian>
Thu 31 May 2012 04:11:05 PM UTC, comment #1: 

Thanks for reporting the bug. I have confirmed it and will boost the severity. This part of the code is in a bad state -- there's a FIXME in do_execute. I haven't had time yet to figure out what's going on.

Paul Eggert <eggert>
Group Member
Thu 31 May 2012 11:18:30 AM UTC, original submission:  

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).

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

Strahinja Kustudic <kustodian>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #26010:  grep-i-diff2.txt added by eggert (3KiB - text/plain - [PATCH] grep: handle -i when chars differ in length but line does not)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by kustodian (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.


    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-06-12 eggert StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2012-06-12 eggert Attached File- Added grep-i-diff2.txt, #26010
    2012-06-12 eggert Attached File#26009 Removed
    2012-06-12 eggert Attached File- Added grep-i-diff.txt, #26009
    2012-05-31 eggert Severity3 - Normal 4 - Important
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.12