This service will be undergoing maintenance at 00:00 UTC, 2016-09-28. It is expected to last about 1 hours
Bug 150436 - problems with PS1 and PROMPT_COMMAND
problems with PS1 and PROMPT_COMMAND
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: bash (Show other bugs)
4.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tim Waugh
Ben Levenson
:
: 150437 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2005-03-06 10:27 EST by Florian Effenberger
Modified: 2007-11-30 17:07 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-07 11:09:22 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
screenshot (8.97 KB, image/jpeg)
2005-03-06 10:28 EST, Florian Effenberger
no flags Details
screenshot (39.01 KB, image/jpeg)
2005-03-07 15:09 EST, Florian Effenberger
no flags Details

  None (edit)
Description Florian Effenberger 2005-03-06 10:27:17 EST
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 10:28:12 EST
Created attachment 111714 [details]
screenshot
Comment 2 Jay Turner 2005-03-07 04:21:05 EST
*** Bug 150437 has been marked as a duplicate of this bug. ***
Comment 3 Tim Waugh 2005-03-07 05:28:13 EST
What does 'echo $TERM' say?
Comment 4 Florian Effenberger 2005-03-07 08:13:13 EST
I tried with TERM=screen and TERM=xterm
Comment 5 Tim Waugh 2005-03-07 11:09:22 EST
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 15:09:19 EST
With TERM=screen, it doesn't work, see attached screenshot.
Comment 7 Florian Effenberger 2005-03-07 15:09:54 EST
Created attachment 111756 [details]
screenshot

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