Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 73752 - weird line wrapping with bash 3.0x with two-line prompt
Summary: weird line wrapping with bash 3.0x with two-line prompt
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-07 21:48 UTC by Botykai Zsolt
Modified: 2005-01-12 08:55 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Botykai Zsolt 2004-12-07 21:48:41 UTC
I'm using:
06:32:45 root ~ # bash --version
GNU bash, version 3.00.13(1)-release (i686-pc-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.
And XTerm(196) (with 80x25 geometry)
06:33:10 root ~ # 
With 'root' my promt is:
PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
(as sourced from /etc/bash/bashrc)
My user promt is (in one line of ~/.bashrc):
export PS1="[\e[31m\$(pwd)\e[0m :: \e[32m\@\e[0m :: e[33m\l\e[0m]\n[\e[32m\u\e[0m@\e[34m\H\e[0m] \$ "
So I checked shopt | grep 'winsize'
checkwinsize    on
Now if I press for example the 'a' key and keep it pressing as 'root', the line wraps normally as it hits the lines end, and continues in the next line. 
But as a user if I do the same: after fourty 'a's the line wraps and continues in the same line's beginning (overwriting the prompt!), but if I keep pressing the key after this "second" line it wraps normally to the next line.
I tried to recompile bash.


Reproducible: Always
Steps to Reproduce:
1. Use my user prompt and bash v3.
2.
3.




Portage 2.0.51-r8 (default-linux/x86/2004.0, gcc-3.4.3, glibc-2.3.4.20041102-r0,
2.6.9-gentoo-r9 i686)
=================================================================
System uname: 2.6.9-gentoo-r9 i686 Intel(R) Celeron(R) CPU 2.40GHz
Gentoo Base System version 1.6.7
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Sep 30 2004, 10:02:31)]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.13, 2.59-r6
sys-devel/automake:  1.5, 1.9.3, 1.6.3, 1.7.9, 1.4_p6, 1.8.5-r2
sys-devel/binutils:  2.15.92.0.2-r1
sys-devel/libtool:   1.5.2-r7
virtual/os-headers:  2.6.8.1-r1
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium4 -funroll-loops -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown
/usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium4 -funroll-loops -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://intranet.online.hu/ http://gentoo.inode.at/
http://gentoo.mirror.icd.hu/ http://gentoo.math.bme.hu/"
MAKEOPTS="-j2 -s"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X alsa apm avi berkdb bitmap-fonts bonobo cdr crypt cups directfb encode
esd f77 fam flac foomaticdb fortran gdbm gif gphoto2 gpm gstreamer gtk gtk2
gtkhtml guile hal imagemagick imlib java jikes jpeg libg++ libwww mad maildir
mbox mikmod motif mozilla mpeg ncurses nls nptl nptlonly oggvorbis opengl oss
pam pdflib perl png ppds python qt quicktime readline ruby samba sdl slang spell
ssl svga tcltk tcpd tiff truetype unicode usb x86 xml xml2 xmms xv zlib
linguas_en linguas_hu"
Comment 1 Aaron Walker (RETIRED) gentoo-dev 2004-12-08 02:27:11 UTC
I'm glad you submitted this bug, because I've been meaning too.  This bug has partially been fixed (see bug 65410), but it seems to only work if the color escapes are formatted a certain way..

For example, I am successfully running a multi line prompt in bash3 by using escape sequences like "\[\033[01;32m\]".  It doesn't like your escape sequences nor ones like "\033[01;32m" however.  Maybe it's overcompensating because of missing chars it thinks are there and thus going to the next line before 80 chars?

base-system, wasn't sure whether to close this and reopen 65410 or keep it as is, so I'll let you guys decide.
Comment 2 Botykai Zsolt 2004-12-08 10:18:29 UTC
Thanks Aaron for this fast answer, I tried to apply that patch, as I found it in bugzilla, but I wasn' successed - maybe I'm not that good at patching, 'cause I'm kinda' noob.
Now trying to figure out which escape sequences to use...
Comment 3 SpanKY gentoo-dev 2004-12-08 10:54:54 UTC
if you guys re-emerge bash does the bug 'go away' ?
Comment 4 Botykai Zsolt 2004-12-08 11:06:56 UTC
Re-emerged bash (yesterday), and from the same xterm I issued: 'bash' && set my prompt but still bed.
Comment 5 Aaron Walker (RETIRED) gentoo-dev 2004-12-08 16:03:00 UTC
Botykai, didnt you read the comments of the other bug?  According to agriffis, the patch was added for bash-3.0-r6 quite a while ago.
Comment 6 Botykai Zsolt 2004-12-10 00:12:49 UTC
Sorry, then I didn't figured it out from the ebuild (and the 'files' dir' of the ebuild (there wern't any patch named like in 65410). 
So I rebuilt again my bash-3.0-r7 which should have been patched, logged out, logged in, and still no good.
Comment 7 SpanKY gentoo-dev 2004-12-15 18:56:35 UTC
this is unrelated to Bug 69407 too right ?
Comment 8 Botykai Zsolt 2004-12-15 22:55:38 UTC
IMHO not because I tried the reproduce steps http://bugs.gentoo.org/show_bug.cgi?id=69407 with LANG=hu_HU.UTF-8 and it did work for me with characters like this:
echo "ab
Comment 9 Botykai Zsolt 2004-12-15 22:55:38 UTC
IMHO not because I tried the reproduce steps http://bugs.gentoo.org/show_bug.cgi?id=69407 with LANG=hu_HU.UTF-8 and it did work for me with characters like this:
echo "ab÷פß$˘°ˇ˙őűúíc"
ab÷פß$˘°ˇ˙őűúíc
Comment 10 Aron Griffis (RETIRED) gentoo-dev 2005-01-12 08:55:13 UTC
In your report, you say:

export PS1="[\e[31m\$(pwd)\e[0m :: \e[32m\@\e[0m :: e[33m\l\e[0m]\n[\e[32m\u\e[0m@\e[34m\H\e[0m] \$ "

This is incorrect.  The escape sequences that don't move the cursor need to be marked with \[ and \], as explained in the bash man-page under PROMPTING.  If you don't do that, then bash (as you've found) gets confused regarding the width of the terminal.  This appears to be pilot error.