Package: bash
Version: 3.0-14
Followup-For: Bug #265182

The issue is that prompts with embedded escape sequences whose final 
line extended beyond a single line on the screen do not wrap correctly.

Please do not try to hand-wave this away as an improper use of escape 
sequences, or try to point anybody to the BASH FAQ section E3, which has 
nothing to do with this actual, real bug that has been annoying people 
for a long while. =)

I was going to report this bug separately, but I found this reported, 
and it looks like the same issue. Here is a fairly easy reproduction 
recipie.

1) Open a terminal (xterm, whatever, it doesn't matter)

2) Run the following commands

(your current prompt)$ cd /tmp; PS1='\w$ '
/tmp$ mkdir 
this_is_an_incredibly_long_directory_name_which_is_specificially_designed_to_demonstrate_a_bug_in_bash_prompting_which_although_some_refuse_to_acknowledge_does_in_fact_exist
/tmp$ cd 
this_is_an_incredibly_long_directory_name_which_is_specificially_designed_to_demonstrate_a_bug_in_bash_prompting_which_although_some_refuse_to_acknowledge_does_in_fact_exist

3) So far so good, the prompt now should be wrapped across several lines. If 
it's not(?!), make your terminal smaller until it is.

/tmp/this_is_an_incredibly_long_directory_name_which_is_specificially_designed_to_demonstrate_a_bug_in_bash_prompting_which_although_some_refuse_to_acknowledge_does_in_fact_exist$
 

4) With this prompt, type some really long text and watch what happens. Try 
using CTRL-A, and CTRL-E using the cursor keys, or whatever. This is the 
control case, everything works perfectly here. Give it a try and see.

/tmp/this_is_an_incredibly_long_directory_name_which_is_specificially_designed_to_demonstrate_a_bug_in_bash_prompting_which_although_some_refuse_to_acknowledge_does_in_fact_exist$
 echo type in a really really long commandline that is long enough that it 
wraps around on your terminal, perferable several times so that you can get a 
nice big long piece of text to work with; after you've typed all this stuff, 
you should be able to use the arrow keys, and whatever; line wrapping should 
work correctly initially, and should also do the correct thing when you use the 
arrow keys to go all the way back to the beginning of the prompt

5) Now, issue the following command, which just adds some escape characters 
that will not actually affect the initial visual display of the prompt for any 
usual terminal:

/tmp/this_is_an_incredibly_long_directory_name_which_is_specificially_designed_to_demonstrate_a_bug_in_bash_prompting_which_although_some_refuse_to_acknowledge_does_in_fact_exist$
 PS1='\[\e[0m\]\w\[\e[0m\]$ \[\e[0m\]'

6) Uh oh! If you have your terminal set small enough, this prompt already 
displays incorrectly. For example, it might looks like this, as it does in my 
particular terminal this very moment:

/tmp/this_is_an_incredibly_long_directory_name_which_is_specificially_d
esigned_to_demonstrate_a_bug_in_bash_prompting_which_although_some_refu
se_to_a
cknowledge_does_in_fact_exist$ 

7) Notice that after the "se_to_a", an extra extraneous line break is added. 
But the worst is still to come. Now start typing some long command line. Use 
the arrow keys to go back to the beginning, and back to the end. Try CTRL-A and 
CTRL-E. You'll see the bug.

In summary, if you make your terminal short enough or have a long enough last 
line of your prompt, and have any escape sequences in that line, this bug rears 
it's ugly head. If you are willing to make your terminal narrow enough, you 
should be able to reproduce this with not only the example I gave, but just 
about any prompt with any kind of escape in it, including *all* of the prompts 
given in the bash prompting howto. It doesn't matter how carefully you use \[ 
and \]; this bug will still show up. Not using \[ and \] of course makes things 
even worse, but they aren't related to this bug.

-- System Information:
Debian Release: 3.1
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.9-10-amd64-k8
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages bash depends on:
ii  base-files     3.1.2-0.0.0.3.pure64      Debian base system miscellaneous f
ii  libc6          2.3.2.ds1-20.0.0.1.pure64 GNU C Library: Shared libraries an
ii  libncurses5    5.4-4                     Shared libraries for terminal hand
ii  passwd         1:4.0.3-30.9              change and administer password and

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to