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

Submitted by:  Strahinja Kustudic <kustodian>
Submitted on:  Thu 31 May 2012 11:18:30 AM UTC  
 
Category: NoneSeverity: 4 - Important
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned 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>
Project 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>
Project 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>
Project 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>
Project 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>

 

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
  • -unavailable- added by eggert (Posted a comment)
  • -unavailable- added by kustodian (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 12 Jun 2012 04:49:54 PM UTCeggertStatusConfirmed=>Fixed
      Open/ClosedOpen=>Closed
    Tue 12 Jun 2012 04:01:56 PM UTCeggertAttached File-=>Added grep-i-diff2.txt, #26010
    Tue 12 Jun 2012 04:00:18 PM UTCeggertAttached File#26009=>Removed
    Tue 12 Jun 2012 03:50:22 PM UTCeggertAttached File-=>Added grep-i-diff.txt, #26009
    Thu 31 May 2012 04:11:05 PM UTCeggertSeverity3 - Normal=>4 - Important
      StatusNone=>Confirmed

    Back to the top


    Powered by Savane 3.1-cleanup1