Bug 19205

Summary: The "-title" parameter for xterm and gnome-terminal doesn't work
Product: [Retired] Red Hat Linux Reporter: danmcnaul
Component: setupAssignee: Bill Nottingham <notting>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: low Docs Contact:
Priority: low    
Version: 7.0CC: danmcnaul, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-05-21 19:09:09 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:

Description danmcnaul 2000-10-16 21:09:05 UTC
The "-title" command line parameter for xterm and/or gnome-terminal does 
not work.  The title provided does appear momentarily on the new window, 
but is quickly replaced with "userid@machine dirname".  The title is 
displayed correctly when one exports "TERM=vt220", but that is the only 
terminal type I found that it worked for.  The same bug exists for both "-
t" and "-title".

Comment 1 Alan Cox 2000-10-16 23:37:05 UTC
The default prompt sets the titlebar too. Set the PROMPT_COMMAND environment
variable differently

Comment 2 danmcnaul 2000-10-17 18:27:18 UTC
There is no PROMPT_COMMAND environment variable set on my system to conflict 
with the -title parameter.  This IS a bug.  The -title should set the title bar 
as stated in the man pages.  As it did in past releases.

McNaul

Comment 3 Simon Hill 2000-10-30 23:28:43 UTC
I agree with Dan. I have scripts that put specific titles on specific xterms
running specific programs which I use in my work. Now they are all overidden
with the 'user@hostname pwd' and I cannot distinguish them at a glance on the
KDE taskbar, because now they all show the same user name and part of the
hostname.

It is all very well to add a new option and environment variable, but the
DEFAULT BEHAVIOR when the variable is not set (which it isn't) SHOULD NOT
CHANGE. I do not know where to find documentation on this variable or how to set
it to get the old behavior back, and I SHOULDN'T HAVE TO. Meanwhile, my work
patterns are disrupted and my productivity is decreased....


Comment 4 Simon Hill 2000-10-30 23:36:48 UTC
Oh, I notice that this bug is for RH7.0. Actually the problem began in RH6.2.
Also, please excuse my caps - I don't mean to shout - it's just easier than
italics or bold ;-)


Comment 5 Mike A. Harris 2001-04-02 17:40:46 UTC
I just reproduced this and it *is* extremely annoying, I agree.
I tracked the problem down to /etc/bashrc, it contains code:

if [ "$PS1" ]; then
    if [ -x /usr/bin/tput ]; then
      if [ "x`tput kbs`" != "x" ]; then # We can't do this with "dumb" terminal
        stty erase `tput kbs`
      fi
    fi
    case $TERM in
	xterm*)
	    PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
	    ;;
	*)
	    ;;
    esac

This is totally broken, and should not be forced upon a user.  This code
needs to be removed, moved to the skeleton files so a user can disable it
if they want, or implemented in another way.  I recommend doing away with
it myself, but that decision is ultimately up to the bash package
maintainer.  Changing packages..

Comment 6 Mike A. Harris 2001-04-02 17:50:25 UTC
Bero, can you look into this and see if there is an obvious way to fix it?
For now the obvious workaround is editing ~/.bashrc and stopping it from
sourcing /etc/bashrc

I'm not sure how you'd go about detecting wether or not xterm has been
given a title argument.  If it cannot be fixed easily, the best way is
likely to change the default behaviour of xterm to display
user@host:[$|#]<cwd>

Let me know if you think this is best, and I'll hack on xterm.

Comment 7 Mike A. Harris 2001-04-02 18:49:21 UTC
I just looked into the xterm source and while I could hack this
into xterm for the default window title, once it is set, it will stay
like that so it isn't very useful because the path does not bet updated
when you cd.

So..  I think the code should be moved to the .bashrc skeleton files
instead of /etc/bashrc, and logic put in to determine if xterm is being
called with the title arg.

I'm going to go hack for a bit.

Comment 8 Mike A. Harris 2001-04-02 19:13:17 UTC
I played around with it a bit and here is some crud I came up with.  As
is, it does not quite work, but is close, however it would only work with
xterm, and other similar apps that take -title, -T as args to set the title.

            # Was xterm given the -title or -T args?
            cat /proc/$PPID/cmdline |grep "\-\(title\|T\)" >& /dev/null
            [ $? ] || {
             PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"'
            }

It might be possible to tweak it into working, but it is nothing more than a hack.


Comment 9 Bernhard Rosenkraenzer 2001-05-21 19:09:05 UTC
bashrc lives in setup these days...
The current version has some hooks you might be interested in, though:
If you create
/etc/sysconfig/bash-prompt-xterm
and
/etc/sysconfig/bash-prompt-default
they will override the default PROMPT_COMMAND.



Comment 10 Bill Nottingham 2001-05-21 19:20:18 UTC
Also, you can override it in your ~/.bashrc.