Red Hat Bugzilla – Bug 113195
First line displayed incorrectly if prompt changes background color
Last modified: 2008-03-10 00:54:45 EDT
Description of problem:
If the PS1 prompt environment variable changes the background color
the entire first line is displayed with that color eventhough only the
prompt should have a different background color. Initially the problem
is only visible in the first two chars right of the cursor, but if
parts of the window is redrawn for example after being hidden behind
another window, the entire first line is shown with wrong background
color. If a reset sequence ESC c is sent to the terminal, the problem
disapears, only the first line after the window has been opened is
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. PS1='\[\015\033[46m\][\u@\h:\w]\[\033[0m\] gnome-terminal
The prompt and some chars right of the cursor is displayed with
different background color.
Only the prompt is displayed with different background color, the rest
of the first line is displayed with white background color.
Created attachment 96860 [details]
Screenshot of incorrectly displayed gnome-terminal
Fedora Core 1 is now maintained by the Fedora Legacy project for
security updates only. If this problem is a security issue, please
reopen and reassign to the Fedora Legacy product. If it is not a
security issue and hasn't been resolved in the current FC3 updates or
in the FC4 test release, reopen and change the version to match.
This bug also exist in FC3. And just in case it isn't obvious, there is a minor
typo in the command to reproduce the symptom, a ' character is missing. Using
this command will reproduce the problem:
PS1='\[\033[46m\][\u@\h:\w]\[\033[0m\] ' gnome-terminal
Slightly more robust reproduction instructions:
PS1='\[\033[46m\][\u@\h:\w]\[\033[0m\] ' gnome-terminal --disable-factory -e
This is likely a vte bug (vte is the rendering widget used by gnome-terminal).
I'm going to reassign it to the vte component.
Fedora Core 3 is now maintained by the Fedora Legacy project for security
updates only. If this problem is a security issue, please reopen and
reassign to the Fedora Legacy product. If it is not a security issue and
hasn't been resolved in the current FC5 updates or in the FC6 test
release, reopen and change the version to match.
This problem also exist in FC4. I don't yet have any FC5 installation to test it
Happens in FC5 still. Not sure if it's vte or bash.
I don't see how this could be a bash bug. It works fine with xterm. And I
believe bash does output the correct character sequence. I think the possible
places to search for this bug is in gnome-terminal and the libraries it uses.
It could theoretically be an X server bug. But since I'm able to reproduce this
with an entirely different X server as well, I don't think that is a likely
How do you do the same with xterm? My xterm doesn't seem to pass PS1 to the
xterm certainly should pass the full environment to the shell inside. But maybe
the shell inside will reset the PS1 environment variable, this depends on
configuration files. The following two commands should tell you what environment
is passed (I'll try to come up with a better way to reproduce the problem).
PS1='\[\033[46m\][\u@\h:\w]\[\033[0m\] ' strace -v -f -e execve xterm -e /bin/sh
PS1='\[\033[46m\][\u@\h:\w]\[\033[0m\] ' strace -v -f -e execve gnome-terminal
Does this show the difference in your case?
printf '\033[46m[\u@\h:\w]\033[0m ' >/tmp/PS1
gnome-terminal -e 'cat /tmp/PS1 /dev/tty'
xterm -e 'cat /tmp/PS1 /dev/tty'
(In reply to comment #11)
> Does this show the difference in your case?
> printf '\033[46m[\u@\h:\w]\033[0m ' >/tmp/PS1
> gnome-terminal -e 'cat /tmp/PS1 /dev/tty'
> xterm -e 'cat /tmp/PS1 /dev/tty'
Yep, that does the trick.
Fedora Core 5 is not maintained anymore.
Can you reproduce this bug in Fedora 8?
I haven't been able to reproduce it in Fedora 8. (Have only tried two times).