Red Hat Bugzilla – Bug 1465814
grep: Character in last column of terminal gets erased in certain cases (depends on char coloring)
Last modified: 2017-12-12 05:30:25 EST
+++ This bug was initially created as a clone of Bug #1459451 +++
A character in the last column of a terminal gets erased if
* it is colored and the following character (if one exists) is not, OR
* it is not colored and the following character is.
Occurs in all environments I've tested. These include:
* RHEL (over ssh) and Fedora
* bash and ksh
* agetty and xterm
Use cases include:
* colored output of grep (the most serious case I suppose)
* colored output of gcc
Note that a bash alias for automatic grep output colorization is present by default in both RHEL and Fedora.
I don't know where the problem is, but I'm filing this against glibc, because it seems to be the most sensible factor common to all the software affected/involved.
Version-Release number of selected component (if applicable):
bash-4.2.46-20.el7_2.x86_64 (RHEL 7.3)
glibc-2.17-157.el7.x86_64 (RHEL 7.3)
Steps to Reproduce:
$ echo $COLUMNS
$ alias grep
alias grep='grep --color=auto'
$ echo 12345678901234567890123|grep 23
$ echo 123456789012345678901234567890|grep 3
In the first "echo|grep" call above, the last character ('3') is missing. In the second call, the last character '3' is missing in the string.
Both above "echo|grep" calls output the same string that appears as the parameter of echo.
--- Additional comment from Roman Žilka on 2017-06-07 10:17:30 CEST ---
Correction/observation: all the utilities that produce colored output that I've tested this on print bold+colored characters, not just colored.
--- Additional comment from Florian Weimer on 2017-06-28 11:32:41 CEST ---
I can reproduce this with xterm-327-2.fc25.x86_64 and with screen-4.5.1-2.fc25.x86_64 and screen-4.5.1-2.fc24.x86_64 running in a GNOME terminal. gnome-terminal-3.22.1-5.fc25.x86_64 and vte291-0.46.2-1.fc25.x86_64 do not seem to have this bug when displaying the output directly (without an intermediate screen).
It is actually unrelated to grep and glibc. It looks more like a common terminal emulator bug.
This command always writes the same bytes:
If the terminal is exactly 23 characters wide, the string is truncated and the last 3 is not displayed.
I could reproduce this with screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64, so reassigning to that component. If you use a different terminal emulator under Red Hat Enterprise Linux 7, we need to clone this bug.
In original bug report, this issue has been reassigned to grep.
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.