Bug 113195

Summary: First line displayed incorrectly if prompt changes background color
Product: [Fedora] Fedora Reporter: Kasper Dupont <bugzilla>
Component: vteAssignee: Behdad Esfahbod <behdad>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Fedora 8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-03-10 04:54:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Screenshot of incorrectly displayed gnome-terminal none

Description Kasper Dupont 2004-01-09 16:28:33 UTC
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
affected.

Version-Release number of selected component (if applicable):
2.4.0.1-1

How reproducible:
Happens always

Steps to Reproduce:
1. PS1='\[\015\033[46m\][\u@\h:\w]\[\033[0m\] gnome-terminal
  
Actual results:
The prompt and some chars right of the cursor is displayed with
different background color.

Expected results:
Only the prompt is displayed with different background color, the rest
of the first line is displayed with white background color.

Comment 1 Kasper Dupont 2004-01-09 16:29:42 UTC
Created attachment 96860 [details]
Screenshot of incorrectly displayed gnome-terminal

Comment 2 Ray Strode [halfline] 2005-05-11 22:14:54 UTC
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.

Comment 3 Kasper Dupont 2005-05-12 06:53:46 UTC
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


Comment 4 Ray Strode [halfline] 2005-05-12 14:36:25 UTC
Hmm, interesting.  

Slightly more robust reproduction instructions:

PS1='\[\033[46m\][\u@\h:\w]\[\033[0m\] ' gnome-terminal --disable-factory -e
"/bin/sh"

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.


Comment 5 Matthew Miller 2006-07-10 19:43:15 UTC
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.


Comment 6 Kasper Dupont 2006-07-10 19:57:05 UTC
This problem also exist in FC4. I don't yet have any FC5 installation to test it
there.

Comment 7 Behdad Esfahbod 2006-07-10 21:28:34 UTC
Happens in FC5 still.  Not sure if it's vte or bash.

Comment 8 Kasper Dupont 2006-07-10 21:36:18 UTC
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
explanation.

Comment 9 Behdad Esfahbod 2006-07-10 22:49:28 UTC
How do you do the same with xterm?  My xterm doesn't seem to pass PS1 to the
bash inside.

Comment 10 Kasper Dupont 2006-07-11 07:11:15 UTC
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
-e /bin/sh


Comment 11 Kasper Dupont 2006-07-11 07:16:02 UTC
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'


Comment 12 Behdad Esfahbod 2006-07-14 16:02:25 UTC
(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.


Comment 13 petrosyan 2008-02-15 22:44:51 UTC
Fedora Core 5 is not maintained anymore.

Can you reproduce this bug in Fedora 8?

Comment 14 Kasper Dupont 2008-02-16 01:37:56 UTC
I haven't been able to reproduce it in Fedora 8. (Have only tried two times).