Bug 150436 - problems with PS1 and PROMPT_COMMAND
Summary: problems with PS1 and PROMPT_COMMAND
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: bash   
(Show other bugs)
Version: 4.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
: ---
Assignee: Tim Waugh
QA Contact: Ben Levenson
URL:
Whiteboard:
Keywords:
: 150437 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-06 15:27 UTC by Florian Effenberger
Modified: 2007-11-30 22:07 UTC (History)
0 users

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 (Terms of Use)
screenshot (8.97 KB, image/jpeg)
2005-03-06 15:28 UTC, Florian Effenberger
no flags Details
screenshot (39.01 KB, image/jpeg)
2005-03-07 20:09 UTC, Florian Effenberger
no flags Details

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


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