FS#43421 - [gnome-terminal] "grep --color" eats character at terminal boundary.

Attached to Project: Arch Linux
Opened by Chunwei Chen (tuxoko) - Monday, 12 January 2015, 15:22 GMT
Last edited by Jan de Groot (JGC) - Sunday, 05 April 2015, 10:47 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Jan de Groot (JGC)
Jan Alexander Steffens (heftig)
Architecture x86_64
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

"grep --color" eats character at terminal boundary.

Additional info:
grep 2.21-1
gnome-terminal 3.14.2-1


Steps to reproduce:

For example, doing "ps aux | grep system"

In nocolor.png, you can see that there are several lines wrap at "system".
In color.png, adding --color causes the last character 'm' to disappear.
In other two pngs, you can see that grepping "syste" or "systemd" are fine.

Another example, I shrink the terminal width by two, so those lines wrap at "syst"
Now in emd.png, "ps aux | grep emd" also causes the last character 't' to disappear.

So basically, "grep --color" will eat character if your keyword happens to be
just before or just after the line wrap.
This task depends upon

Closed by  Jan de Groot (JGC)
Sunday, 05 April 2015, 10:47 GMT
Reason for closing:  Fixed
Comment by Chunwei Chen (tuxoko) - Monday, 12 January 2015, 15:36 GMT
Oops, it seems that the bug is in gnome-terminal.

Doing "ps aux | grep --color=always system > output.txt"
And the output file seems fine.
Comment by egmont (egmont) - Friday, 16 January 2015, 18:04 GMT
Xterm produces the same behavior, which is due to a stupid xterm feature combined with a stupid grep feature. For details see:
https://bugzilla.gnome.org/show_bug.cgi?id=740789
https://bugzilla.redhat.com/show_bug.cgi?id=1168182
http://savannah.gnu.org/bugs/?36831

Future gnome-terminal-3.16 (actually vte-0.40) will intentionally deviate from xterm so that this doesn't happen.

Until then a workaround is: export GREP_COLORS=ne

The vte fix is here: https://git.gnome.org/browse/vte/commit/?id=916964e
Comment by Chunwei Chen (tuxoko) - Sunday, 05 April 2015, 09:40 GMT
Hi, I've tested it on gnome-terminal 3.16.0-1 in test repo.
And I confirmed that the issue has been fixed.

Thanks.

Loading...