buggrep - Bugs: bug #25063, grep --color clears line when CR...

 
 

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

bug #25063: grep --color clears line when CR matches (because of \33[K Erase Line string)

Submitted by:  None
Submitted on:  Wed 10 Dec 2008 03:19:12 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Wed 23 Dec 2009 10:27:19 AM UTC, comment #1:

You can set GREP_COLORS=ne in the environment to achieve the desired effect.

Paolo Bonzini <bonzini>
Wed 10 Dec 2008 03:19:12 PM UTC, original submission:

"""
$ echo -en 'foo\r\n' | grep --color=auto 'foo'
foo
$ echo -en 'foo\r\n' | grep --color=auto 'foo.'

$ echo -en 'foo\r\n' | grep 'foo.'
foo
"""

Because grep uses the \33[K Erase Line string to end a colored match, it will clear the entire line when a legitimate carriage return (CR) matches in a file with DOS line-endings.

This is not just a theoretical issue. When searching for things at EOL I can't use 'foo$' for DOS-files, so I need to use 'foo[[:blank:]]*$' and that's the one that breaks.

I'm not sure what the best/quickest fix here is, but I'd scrap the """There are no additional disadvantages specific to doing it after SGR END."""-comment from the grep.c file ;-)

Greetings,
Walter Doekes
OSSO B.V.

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bonzini (Posted a comment)
  • -unavailable- added by wdoekes
  •  

    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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 23 Dec 2009 10:27:19 AM UTCbonziniOpen/ClosedOpen=>Closed
      Summarygrep --color clears line when CR matches (because of \\33[K Erase Line string)=>grep --color clears line when CR matches (because of \33[K Erase Line string)
    Wed 23 Dec 2009 10:27:18 AM UTCbonziniStatusNone=>Fixed
    Wed 10 Dec 2008 03:21:25 PM UTCwdoekesCarbon-Copy-=>Added wdoekes

    Back to the top


    Powered by Savane 3.1-cleanup1