Summary: | Bash prompt overwriting program output | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Tommy McDaniel <tommstein> |
Component: | Current packages | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED WORKSFORME | ||
Severity: | normal | CC: | bensberg, jakub, martel, plh, tommstein |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | AMD64 | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Tommy McDaniel
2006-05-11 02:20:27 UTC
works fine for me with bash-3.1_p17 what is your PS1 set to (In reply to comment #1) > works fine for me with bash-3.1_p17 > > what is your PS1 set to > I've got bash-3.1_p16. PS1 is: \[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] If it changed recently, it wasn't me. Same here with p16 and p17 In the console, they seem to work normally. Just reverted to bash-3.0-r14 and it seems okay too. Actually, reverting to bash-3.0 just makes what appears to be the same bug manifest under different circumstances. Looking through the official bash patches, the bash mailing list and the gentoo patches, it appears there have been various attempts to fix these/this bash/readline/utf-8 related problem[s], eg bug #69407 and bug #109609 but it seems they have not really been successful. Actualy it has something to do with bash colors. If you leave only the first color everything works correctly: PS1='\[\033[1;32m\]\u@\h \w \$ ' If you add color host it is mangled again: PS1='\[\033[1;32m\]\u@\h\[\033[1;34m\] \w \$ ' BUT! If you move the host after the second color, everything works again: PS1='\[\033[1;32m\]\u@\[\033[1;34m\]\h \w \$ ' The bug exists whatever the locale is set. Be it en_US or en_US.utf8 it jumps to the first column on script end. Well, maybe some emerge info will be useful too: Portage 2.1-r1 (default-linux/x86/2006.0, gcc-4.1.1/vanilla, glibc-2.4-r3, 2.6.16-gentoo-r9n i686) ================================================================= System uname: 2.6.16-gentoo-r9n i686 AMD Athlon(tm) XP 2500+ Gentoo Base System version 1.12.1 dev-lang/python: 2.4.3-r1 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: [Not Present] dev-util/confcache: 0.4.2 sys-apps/sandbox: 1.2.18.1 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r2 sys-devel/gcc-config: 2.0.0_rc1 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r5 ACCEPT_KEYWORDS="x86 ~x86" AUTOCLEAN="yes" CBUILD="i686-pc-linux-gnu" CFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -pipe" CHOST="i686-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/lib/mozilla/defaults/pref /usr/share/X11/xkb /usr/share/config" CONFIG_PROTECT_MASK="/etc/env.d /etc/eselect/compiler /etc/gconf /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-O2 -march=athlon-xp -fomit-frame-pointer -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig confcache distlocks fixpackages metadata-transfer sandbox sfperms strict" GENTOO_MIRRORS="ftp://mirror.icis.pcz.pl/gentoo/" LANG="en_US" LC_ALL="en_US.utf8" LINGUAS="en pl" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage" USE="x86 3dnow X acpi alsa apache2 apm arts avi berkdb bitmap-fonts cli crypt cups dbus dlloader dri eds emboss encode esd foomaticdb fortran gd2 gdbm gif gnome gpm gstreamer gtk gtk2 hal imlib isdnlog jpeg kde kdeenablefinal libg++ libwww mad mikmod mmx motif mp3 mpeg ncurses nls nptl nvidia ogg opengl pam pcre pdflib perl php png pppd python qt quicktime readline reflection sdl session spell spl sse ssl tcpd truetype truetype-fonts type1-fonts udev unicode utf8 xml xml2 xmms xorg xprint xv zlib elibc_glibc input_devices_-acecad input_devices_-aiptek input_devices_-calcomp input_devices_-citron input_devices_-digitaledge input_devices_-dmc input_devices_-dynapro input_devices_-elo2300 input_devices_-elographics input_devices_-evdev input_devices_-fpit input_devices_-hyperpen input_devices_-jamstudio input_devices_-joystick input_devices_keyboard input_devices_-magellan input_devices_-magictouch input_devices_-microtouch input_devices_mouse input_devices_-mutouch input_devices_-palmax input_devices_-penmount input_devices_-spaceorb input_devices_-summa input_devices_-synaptics input_devices_-tek4957 input_devices_-ur98 input_devices_-vmmouse input_devices_-void input_devices_-wacom kernel_linux linguas_en linguas_pl userland_GNU video_cards_-apm video_cards_-ark video_cards_-ati video_cards_-chips video_cards_-cirrus video_cards_-cyrix video_cards_-dummy video_cards_fbdev video_cards_-fglrx video_cards_-glint video_cards_-i128 video_cards_-i740 video_cards_-i810 video_cards_-imstt video_cards_-mga video_cards_-neomagic video_cards_-nsc video_cards_-nv video_cards_nvidia video_cards_-rendition video_cards_-s3 video_cards_-s3virge video_cards_-savage video_cards_-siliconmotion video_cards_-sis video_cards_-sisusb video_cards_-tdfx video_cards_-tga video_cards_-trident video_cards_-tseng video_cards_-v4l video_cards_vesa video_cards_-vga video_cards_-via video_cards_-vmware video_cards_-voodoo" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_RSYNC_EXTRA_OPTS Ok, I have resolved the issue: Change this line: PS1='\[\033[1;32m\]\u@\h\[\033[1;34m\] \w \$\[\033[00m\] ' To this: PS1='\033[1;32m\u@\h\033[1;34m \w \$\033[00m ' I don't know what this sequence does (\[...\]) but according to bash FAQ, yu don't have to use it in order to color your prompt: http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/c583.html > PS1='\033[1;32m\u@\h\033[1;34m \w \$\033[00m ' That is not the correct fix. Try using Ctrl+R, type a letter and then Home... The line gets royally messed up. > I don't know what this sequence does (\[...\]) See bug #73752 comment #9. you need the \[ and \] see E3 in ftp://ftp.cwru.edu/pub/bash/FAQ also, you should try using \e instead of \033 Tommy, could you try to reproduce the bug with app-shells/bash-3.2_p15-r1? If you do, try to apply patch from bug 156292. I did not manage to reproduce this behavior. Well, with bash-3.1_p16, I am getting the correct results on my laptop. However, based on when I opened this bug, there's a 99% chance that I was using my currently-broken desktop. I don't know why this would happen on my desktop and not my laptop. Based on what was said in comment #4, that "it appears there have been various attempts to fix these/this bash/readline/utf-8 related problem[s]," the problem may be related to the fact that I think I set my desktop up to be more "internationalized." Closing then this bug report as WORKSFORME as bash-3.2 works here even on desktop machine with nls support. If you ever reproduce this bug, please, reopen then. |