Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 620443 - Text might be put in the terminal title instead of the terminal itself
Text might be put in the terminal title instead of the terminal itself
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: setup (Show other bugs)
5.7
All Linux
medium Severity medium
: rc
: ---
Assigned To: Ondrej Vasik
qe-baseos-daemons
:
Depends On: 620408
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-02 10:34 EDT by Roman Rakus
Modified: 2012-02-21 00:39 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 620408
Environment:
Last Closed: 2012-02-21 00:39:13 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2012:0198 normal SHIPPED_LIVE setup bug fix and enhancement update 2012-02-20 09:54:05 EST

  None (edit)
Description Roman Rakus 2010-08-02 10:34:21 EDT
+++ 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@redhat.com on 2010-08-02 09:42:28 EDT ---

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

--- Additional comment from rrakus@redhat.com 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 00:39:13 EST
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.