bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in bash handling of PS1 prompt


From: skt
Subject: bug in bash handling of PS1 prompt
Date: Wed, 22 Jun 2005 15:21:46 -0700

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: i386-redhat-linux-gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib 
-D_GNU_SOURCE  -O2 -march=i386 -mcpu=i686 -g
uname output: Linux skywalker.ca.boeing.com 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 
2003 i686 i686 i386 GNU/Linux
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.05b
Patch Level: 0
Release Status: release

Description:
        [Detailed description of the problem, suggestion, or complaint.]

Not sure if this was meant as a bug or feature,
but I think it is a bug in bash.

When assigning to PS1 to change the prompt, bash
appears to append any new value to the initial default
value, rather than to replace it.   The human user
cannot see the original elements in the prompt.
Although not disturbing visually, bash sends a lot
of unnecessary characters out at each prompt.

If you use "script" or "expect" with logging
turned on, the log will show that each prompt
contains the original and new values of PS1.
Unsetting PS1 and then setting PS1 does not get
around the problem.  Changing PS1 does replace the
last PS1 assignment the user made, but does not
remove the initial value.

Repeat-By:

The bash session shown below was captured with "script",
and then post-processed with "cat -v", and shows the
bug in bash's handling of PS1.  The first prompt shown
below indicates that the PS1 set in the /etc/bashrc
file was added to the default prompt.
The "script" command was run on RedHat 9.0.

Stan Tazuma
Boeing
skt@skywalker.ca.boeing.com


Script started on Wed 22 Jun 2005 02:51:50 PM PDT
^[]0;skt@host:~/bugs/bash-prompt^G[skt@host bash-prompt]$ date^M
Wed Jun 22 14:51:53 PDT 2005^M
^[]0;skt@host:~/bugs/bash-prompt^G[skt@host bash-prompt]$ echo $BASH_VERSION^M
2.05b.0(1)-release^M
^[]0;skt@host:~/bugs/bash-prompt^G[skt@host bash-prompt]$ echo "$PS1"^M
[\u@\h \W]\$ ^M
^[]0;skt@host:~/bugs/bash-prompt^G[skt@host bash-prompt]$ PS1='hello> '^M
^[]0;skt@host:~/bugs/bash-prompt^Ghello> date^M
Wed Jun 22 14:52:20 PDT 2005^M
^[]0;skt@host:~/bugs/bash-prompt^Ghello> PS1=''^M
^[]0;skt@host:~/bugs/bash-prompt^Gdate^M
Wed Jun 22 14:52:25 PDT 2005^M
^[]0;skt@host:~/bugs/bash-prompt^G
Script done on Wed 22 Jun 2005 02:52:29 PM PDT




reply via email to

[Prev in Thread] Current Thread [Next in Thread]