Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 470810 - sys-apps/grep: `grep --colour=auto` truncates last letter on a line
Summary: sys-apps/grep: `grep --colour=auto` truncates last letter on a line
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://savannah.gnu.org/bugs/?36831
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-20 17:08 UTC by Roman Žilka
Modified: 2014-01-02 19:31 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info xterm grep (emerge--info,6.53 KB, text/plain)
2013-05-20 17:09 UTC, Roman Žilka
Details
images (grep-bug-img-pack.tar.xz,24.48 KB, application/x-xz-compressed-tar)
2013-05-20 17:12 UTC, Roman Žilka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Žilka 2013-05-20 17:08:59 UTC
This might introduce some confusion and bad decisions into everyday administration: grep-2.14 with '--colour=auto' (the default in Gentoo) causes the last letter of the matched pattern disappear from output when that letter were to be the last on a terminal's line at the same time.

Tested with xterm, aterm and mlterm, default settings, a different font for each. Tested on two plaintext files as input and on 'cat file|grep'.

img1: a plain cat and alias settings.
img2: the "c" disappears, because it is the last letter of the match pattern and last on a line (although the whole pattern is correctly matched)
img3: when the pattern spans across two lines, nothing bad happens
img4: another instance of the last letter of pattern disappearing
img5: nothing bad happens at the beginning of a line
img6: when the pattern doesn't reach to the end of a line, nothing bad happens

Reproducible: Always
Comment 1 Roman Žilka 2013-05-20 17:09:51 UTC
Created attachment 348768 [details]
emerge --info xterm grep
Comment 2 Roman Žilka 2013-05-20 17:12:00 UTC
Created attachment 348770 [details]
images

A Czech proverb says: "A good picture speaks a thousand ..." ... ah, nevermind.
Comment 3 Roman Žilka 2013-05-20 17:18:41 UTC
When I unalias grep, the bug is gone. BTW, the bug happens with a 3.8 kernel too, not just 3.9.:)
Comment 4 Roman Žilka 2013-05-21 14:13:48 UTC
I get the same bug on a x86, non-hardened box.

The bug is present with USE="-pcre -nls" too.
Comment 5 SpanKY gentoo-dev 2014-01-02 19:30:53 UTC
i'm not sure this will ever really get fixed ... it's a crap situation.  see this for more info:
http://git.savannah.gnu.org/cgit/grep.git/tree/src/main.c?id=88d65410f7aa472c66da1bdf01c3cc1439cefce6#n142

you should be able to workaround it by doing:
 export GREP_COLORS=ne

in your ~/.bash_profile or wherever