Bug 620443 - Text might be put in the terminal title instead of the terminal itself
Summary: Text might be put in the terminal title instead of the terminal itself
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: setup
Version: 5.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Ondrej Vasik
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On: 620408
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-08-02 14:34 UTC by Roman Rakus
Modified: 2012-02-21 05:39 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 620408
Environment:
Last Closed: 2012-02-21 05:39:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0198 0 normal SHIPPED_LIVE setup bug fix and enhancement update 2012-02-20 14:54:05 UTC

Description Roman Rakus 2010-08-02 14:34:21 UTC
+++ This bug was initially created as a clone of Bug #620408 +++

Description of problem:
Due to the fix of bug #142125 the default PROMPT_COMMAND has been set to a list of two commands.  This causes strange behaviour when the output of a background process might get flushed after the output of the first PROMPT_COMMAND echo and hence appear between the escape sequences which mark the X terminal title.  It also means the text doesn't appear in the terminal itself.

Version-Release number of selected component (if applicable):
bash-4.1.2-2.el6.x86_64

How reproducible:
Sometimes

Steps to Reproduce:
1. In xterm/gnome-terminal/Terminal run: yes &
2. while 'yes' is running: cat /var/log/yum.log (or whatever application which prints out something on the terminal and takes some time)
3. Look at the terminal title -- it would read something like "tsmetana@localhost:~/bash_testy y y y y y"
4. if not GOTO 2.
  
Actual results:
The text printed in the terminal title was not printed in the terminal window (this can be verified by running something else than 'yes' -- e.g. a simple c-program which outputs a number sequence)

Expected results:
The output of PROMPT_COMMAND shouldn't get mixed with the other text that goes to the terminal.

Additional info:
There is a simple way to check the more commands in PROMPT_COMMAND can have unusual consequence -- try to add sleep between the two commands:

export PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}"; sleep 1; echo -ne "\007"'

Now just press enter and some random keys on the keyboard, then look at the xterm title -- it would contain the keys you pressed.  Note that the sleep only increases the chance for this to happen.

I'm not actually sure how to solve the problem properly: maybe the bug #142125 has to be fixed some other way and PROMPT_COMMAND should be reverted to the old value with just one echo command.

--- Additional comment from rrakus on 2010-08-02 09:42:28 EDT ---

I guess we should use `printf' instead of `echo'.

--- Additional comment from rrakus on 2010-08-02 10:08:23 EDT ---

PROMPT_COMMAND='printf "\033]0;%s@%s:%s\007" "${USER}" "${HOSTNAME%%.*}" "${PWD/#HOME/~}"'

works for me. Reassigning to setup.

Comment 12 errata-xmlrpc 2012-02-21 05:39:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0198.html


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