Bug 1465814 - grep: Character in last column of terminal gets erased in certain cases (depends on char coloring)
Summary: grep: Character in last column of terminal gets erased in certain cases (depe...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: grep
Version: 25
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1459451
TreeView+ depends on / blocked
 
Reported: 2017-06-28 09:34 UTC by Florian Weimer
Modified: 2017-12-12 10:30 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1459451
Environment:
Last Closed: 2017-12-12 10:30:25 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Florian Weimer 2017-06-28 09:34:11 UTC
+++ 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)
bash-4.3.43-4.fc25.x86_64 (F25)
ksh-20120801-31.fc25.x86_64 (F25)
glibc-2.17-157.el7.x86_64 (RHEL 7.3)
glibc-2.24-4.fc25.x86_64 (F25)

Steps to Reproduce:
$ echo $COLUMNS
23
$ alias grep
alias grep='grep --color=auto'
$ echo 12345678901234567890123|grep 23
1234567890123456789012
$ echo 123456789012345678901234567890|grep 3
12345678901234567890124567890

Actual results:
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.

Expected results:
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:

printf '1\33[01;31m\33[K23\33[m\33[K45678901\33[01;31m\33[K23\33[m\33[K45678901\33[01;31m\33[K23\33[m\33[K\n'

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.

Comment 1 Josef Ridky 2017-07-10 11:01:37 UTC
In original bug report, this issue has been reassigned to grep.

Comment 2 Fedora End Of Life 2017-11-16 19:02:42 UTC
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'
of '25'.

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.

Comment 3 Fedora End Of Life 2017-12-12 10:30:25 UTC
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
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.