Bug 150436

Summary: problems with PS1 and PROMPT_COMMAND
Product: Red Hat Enterprise Linux 4 Reporter: Florian Effenberger <floeff>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-03-07 16:09:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
screenshot
none
screenshot none

Description Florian Effenberger 2005-03-06 15:27:17 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de-DE; rv:1.7.6) Gecko/20050223 Firefox/1.0.1

Description of problem:
Hello,

it seems that PuTTY 0.57 has problems with PS1 and PROMPT_COMMAND. Whenever I type some text, press Home and End some times, the text gets mixed up. See attached screenshot.

The prompt in Red Hat Enterprise Linux is as follows:

if [ "$PS1" ]; then
    case $TERM in
        xterm*)
                if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
                else
                PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
                fi
                ;;
        screen)
                if [ -e /etc/sysconfig/bash-prompt-screen ]; then
                        PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
                else
                PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
                fi
                ;;
        *)
                [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
            ;;
    esac

Florian

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


How reproducible:
Always

Steps to Reproduce:
See above.

Additional info:

Comment 1 Florian Effenberger 2005-03-06 15:28:12 UTC
Created attachment 111714 [details]
screenshot

Comment 2 Jay Turner 2005-03-07 09:21:05 UTC
*** Bug 150437 has been marked as a duplicate of this bug. ***

Comment 3 Tim Waugh 2005-03-07 10:28:13 UTC
What does 'echo $TERM' say?

Comment 4 Florian Effenberger 2005-03-07 13:13:13 UTC
I tried with TERM=screen and TERM=xterm

Comment 5 Tim Waugh 2005-03-07 16:09:22 UTC
Well, I meant if you don't set it yourself, but the documentation answers me:

==>
A.5.1 What terminal type does PuTTY use?

For most purposes, PuTTY can be considered to be an xterm terminal. 

[...]

By default, PuTTY announces its terminal type to the server as xterm. If you
have a problem with this, you can reconfigure it to say something else; vt220
might help if you have trouble.
<==

If this doesn't set your window title to show user 'foo':

(USER=foo eval "$PROMPT_COMMAND"; sleep 5)

then it's a PuTTY bug I think.

Comment 6 Florian Effenberger 2005-03-07 20:09:19 UTC
With TERM=screen, it doesn't work, see attached screenshot.

Comment 7 Florian Effenberger 2005-03-07 20:09:54 UTC
Created attachment 111756 [details]
screenshot